For starters: MPLab 8.10, ICD2, PIC12F629, PBP 2.50a
Initializations
Include "modedefs.bas"
trisio =%110000
red var gpio.0 'red
blue var gpio.1 'blue
buzzer var gpio.2 'buzzer
Contact var gpio.4 'Input1
Contact1 var gpio.5 'Input2
i var byte 'general counter
k var byte 'general counter
My initializations stay the same for all below.
main:
red=0
blue=1
pause 500
blue=0
red=1
pause 500
goto main
This code alternates a red and blue LED as expected. Good.
main:
red=0
blue=1
pause 500
red=1
blue=0
pause 500
goto main
This code... blue light comes on... blue light goes off(red doesnt come on). Not good. Shouldnt they alternate???
main:
blue=1
red=0
pause 500
red=1
blue=0
pause 500
goto main
This code... nothing happens. ??? Shouldnt they alternate
main:
blue=1
red=1
pause 500
goto main
This program results in only red. I think it should result in both?
The above programs and results were done in my 12f629. This is my first time with such a weak PIC, but its job is super simple and its the cheapest and smallest PIC we stock here. I put the same code into my 18F2520 and 4520s and they act as I would expect they act. Could someone explain to me why it appears to be only taking the last variable I use, be it red or blue and using that one. Am I expecting something wrong? If so why are my expectations correct for the 2520 series?
So I've been programming with PBP for quite a while now, about 6 months. I think i've done some pretty complex and advanced programs in PBP and now I feel kind of bad with this ultra-noob question.
PBP was my first experience with MCUs(I had programmed my fair share of things, but all in C, or basic on a PC), consequently I was not... enamoured so to speak with PBP. This semester I took a class on MCU's and programmed the entire class in assembly, and did my class final project in C.(We used freescale... eww.) Consequently... I'm back to PBP and PICs and I have a much higher impression of how truly useful and easy it is but this just baffles me. Its so simple... am I missing something obvious?
Bookmarks