Hello Bruno333,
B>>Certainly you can symbol a specific output right?<<
Yes, you can. But I wanted to give you the simplist of code to start out with.
LEDPin var GPIO.2
Loop:
High LEDPin
pause 500
Low LEDPin
Pause 500
goto Loop
end
Dwayne
Hello Bruno333,
B>>Certainly you can symbol a specific output right?<<
Yes, you can. But I wanted to give you the simplist of code to start out with.
LEDPin var GPIO.2
Loop:
High LEDPin
pause 500
Low LEDPin
Pause 500
goto Loop
end
Dwayne
Last edited by Dwayne; - 27th April 2005 at 22:11.
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
FYI TRIS statements are not necessary when you're using the PBP HIGH & LOW commands. PBP *automatically* sets the pin up as an output.
If you use GPIO.2 = 1 or 0, then you'll need to first set the TRIS register to make this bit an output. If you use HIGH or LOW GPIO.2, then PBP sets GPIO.2 up as an output automatically.
Why the PicKit board gives you odd results is due to the way the LED's are wired on the board. Look for the PicKit board schematic or download it here http://ww1.microchip.com/downloads/e...Doc/40051D.pdf
Here's a simple BASIC example that strobes LED's D0 to D7 on the PicKit 1 board.
Code:@ DEVICE PIC12F675, INTRC_OSC, WDT_OFF, MCLR_OFF Define OSCCAL_1K 1 ' Calibrate internal oscillator CMCON = 7 ' Comparators OFF ANSEL = 0 ' A/D OFF ' Modified from Microchip PicKit 1 state.asm demo source D0_D1 CON %00001111 ; TRISIO setting for D0 and D1 D2_D3 CON %00101011 ; TRISIO setting for D2 and D3 D4_D5 CON %00011011 ; TRISIO setting for D4 and D5 D6_D7 CON %00111001 ; TRISIO setting for D6 and D7 '; define LED state (what GPIO will equal) D0_ON CON %00010000 ; D0 LED D1_ON CON %00100000 ; D1 LED D2_ON CON %00010000 ; D2 LED D3_ON CON %00000100 ; D3 LED D4_ON CON %00100000 ; D4 LED D5_ON CON %00000100 ; D5 LED D6_ON CON %00000100 ; D6 LED D7_ON CON %00000010 ; D7 LED TIME VAR BYTE Main: FOR TIME = 50 TO 200 STEP 25 TRISIO = D0_D1 : GPIO = D0_ON PAUSE TIME : GPIO = D1_ON PAUSE TIME TRISIO = D2_D3 : GPIO = D2_ON PAUSE TIME : GPIO = D3_ON PAUSE TIME TRISIO = D4_D5 : GPIO = D4_ON PAUSE TIME : GPIO = D5_ON PAUSE TIME TRISIO = D6_D7 : GPIO = D6_ON PAUSE TIME : GPIO = D7_ON PAUSE TIME NEXT TIME GOTO Main
Last edited by Bruce; - 28th April 2005 at 05:26.
Yeah, I just figured out the LED wiring of the Pickit a few minutes ago before I read your post. Very strange way to do things? I've used several development boards, and usually LED's are wired individually to the separate pins so you can quickly (and simply) check program operation. Why on earth did they do it this way? The LED's are wired with several forward and other's reverse polarity. Sure I guess you might want to experiment with Hi and low outputs... but geeze what a mess.
Besides that, it's a nice programmer. No wall-wart, and 36 bucks.
hehe that's what i often call an engineer trip. Bah that's doing food for your brain cells.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I think the idea was to show creative appplication of limited resource devices like the 8 & 14-pin targets. It is a nifty board considering the investment.
Bookmarks