MrDEB
Well-Known Member
conducting a basic electronics merit badge class this Saturday, 3/13/10 and now that I have my PIC /LCD working I though about adding some knight rider lights"leds"
Just to get the scouts appetite wet for PICs.
Plus the LEDs would better example of the add on circuit of the toy organ I designed and made 12 pcboards. Its just a 555 with pushbuttons to change the frequencies fed to a speaker. An additional circuit would be to add 2- 4017's to the output (divide by 10 then drive 6 LEDs.
Well I started hashing out a simple code but not real proficient in programing yet!
The code hangs up on the TOGGLE portA.x
X defines which port is on then instead of DEC X plan to INCREMENT X for back and forth
I have pins 2 - 9 with a ribbon cable soldered to them for connection to my breadboard w/ LEDs and a 330 resistor
Just to get the scouts appetite wet for PICs.
Plus the LEDs would better example of the add on circuit of the toy organ I designed and made 12 pcboards. Its just a 555 with pushbuttons to change the frequencies fed to a speaker. An additional circuit would be to add 2- 4017's to the output (divide by 10 then drive 6 LEDs.
Well I started hashing out a simple code but not real proficient in programing yet!
The code hangs up on the TOGGLE portA.x
X defines which port is on then instead of DEC X plan to INCREMENT X for back and forth
I have pins 2 - 9 with a ribbon cable soldered to them for connection to my breadboard w/ LEDs and a 330 resistor
Code:
Device = 18F452
Clock = 10
// alias to port pin...
Dim porta(5) As Word
Dim x(3)As Word
//porta
While True
// main program.
x=4
High porta.x
DelayMS(500
Toggle porta.x
dec x
If x = 4 Then repeat
// Toggle (LED)
//DelayMS (500)
//if x>4 then x = 0
//next