back again now i have some questions about BASIC, i have been testing my skills on the simulator, still dont have the kit yet will have maybe next week.
I already know most of the commands of by heart, and how to implement them into the simulator
but i am confused with some things
eg:
Code:
main:
if pin1 = 1 then
goto traffic
endif
goto main
traffic:
high 0
pause 2000
low 0
high 1
pause 4000
low 1
high 2
pause 6000
low 2
if pin1 = 0 then
goto main
endif
goto traffic
Now with the (if pin1 = 0 then goto main) code, i want that to function anywhere within the traffic section and not have to wait for all the stages befor it gets to that part of the code.
is this possible?
and yes futz i know this code could probably be alot cleaner,lol
The easiest (some would say dirtiest) way would be to write your own delay routine that exits if pin1 is zero. You could then make it slightly cleaner by putting a check after each delay.
Isn't there a PICAxe forum, and loads of examples on the PICAxe website? - it's intended for school kids and teachers, so it has to be nice and simple.
Isn't there a PICAxe forum, and loads of examples on the PICAxe website? - it's intended for school kids and teachers, so it has to be nice and simple.
Now with the (if pin1 = 0 then goto main) code, i want that to function anywhere within the traffic section and not have to wait for all the stages befor it gets to that part of the code.
If you can set an interrupt for that input pin, anytime it changes state normal program execution will be interrupted and an "interrupt service routine" piece of code will be called to handle whatever you want to happen.
I was merely suggesting you try asking where people use them!, there's a thriving PICAxe market, but it's almost entirely schools. Because of that the documentation and examples are supposed to be pretty helpful and extensive, haven't you try checking the examples out?.
I was merely suggesting you try asking where people use them!, there's a thriving PICAxe market, but it's almost entirely schools. Because of that the documentation and examples are supposed to be pretty helpful and extensive, haven't you try checking the examples out?.
Well i have pretty much all the info i need within the PICAXE programming editor i downloaded, and its FULL of examples, but im having trouble with this particular code.
If you can set an interrupt for that input pin, anytime it changes state normal program execution will be interrupted and an "interrupt service routine" piece of code will be called to handle whatever you want to happen.
I have always had good luck with the Picaxe forum. Someone has replied to every thread I have posted. Now they will NOT do your project or school assignment for you but will offer suggestions. Maybe it is a time zone thing with you.
As to the Picaxe being a toy, I find the different versions useful. I have used the BasicAtom, BX-24 and the Stamps and I think the 'axes hold their own against these. A serial port, two resistors and the free Program Editor and you're developing programs that can later be moved to a more capable micro if desired. I haven't had to do that yet. To each his own although I wish Picaxe would label their chips.
BRE
No doubt that Swordfish Basic when used with the !8F PICs is more powerful.
I guess I should have stated my application which is Model Railroad signalling. It is not like designing a logic analyzer where execution speed is very important, several hundreds of milliseconds execution time is more than adequate and the targeted audience will find the Picaxe code much easier to read and understand.
Once you get a PIC programmer you don't need to buy PICAxe's, Atoms, Stamps or whatever. You can just buy any 18F PIC that suits your needs and they will always be cheaper per unit than preprogrammed PICs.