ankitvirdi4
Member level 4
- Joined
- Mar 13, 2012
- Messages
- 70
- Helped
- 4
- Reputation
- 8
- Reaction score
- 4
- Trophy points
- 1,288
- Location
- India
- Activity points
- 1,928
I am new to microcontrollers and I made a simple light chaser with a fixed inbuilt delay for running
My code is
I was wondering if I can control this delay externally? Using a potentiometer. I don't want to use an ADC because I am working with 16F505 which doesn't have one. Can somebody please suggest some other way? Using the timer perhaps? Please help.
My code is
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #include <htc.h> #include "delay.h" void main() { TRISC=0x00; while(1) { PORTC=0b10000000; DelayMs(500); PORTC=0b01000000; DelayMs(500); PORTC=0b00100000; DelayMs(500); PORTC=0b00010000; DelayMs(500); PORTC=0b00001000; DelayMs(500); PORTC=0b00000100; DelayMs(500); PORTC=0b00000010; DelayMs(500); PORTC=0b00000001; DelayMs(500); } }
I was wondering if I can control this delay externally? Using a potentiometer. I don't want to use an ADC because I am working with 16F505 which doesn't have one. Can somebody please suggest some other way? Using the timer perhaps? Please help.
Last edited by a moderator: