boscoj
0
- Joined
- Jun 12, 2010
- Messages
- 448
- Points
- 0
Patent it and sell it to WL
do you program it using a kind of flow chart system or purely writing out code?
I usually plan out my code with a flowchart, but the programming is all done in assembly language (code). Most people find it pretty unintuitive, but I have grown to like it much more than higher level languages. Working in assembly puts the programmer much closer to the actual operation of the processor. Here's an example of some assembly code-it's the loop that runs while the switch is down after Laser Lock has been armed (everything after a semicolon is a comment):
clickloop
call getswitch
ifset switchflag ;if switch has been released
goto clicktest ;go take action
decfsz presstimer,f ;count down press time
goto $+2 ;normally jump ahead
bcf clickflag ;if press time was too long, clear the click flag
decfsz blinktimer,f
goto clickloop ;not zero, continue looping
movfw GPIO ;blink timer was zero, so
xorlw b'00000001'
movwf GPIO ;toggle the led
movlw blinktime2
movwf blinktimer ;reload the blink timer
goto clickloop ;stay in the loop
If you are interested in working with PICs, this is a great place to start: Gooligum Electronics