If all you are wanting to do is make the code readable
You get the picture.Code:ZIG1 VAR PORTC.5 ZIG2 VAR PORTC.0 ZIG3 VAR PORTC.4
If all you are wanting to do is make the code readable
You get the picture.Code:ZIG1 VAR PORTC.5 ZIG2 VAR PORTC.0 ZIG3 VAR PORTC.4
Dave
Always wear safety glasses while programming.
Of course it's possible.
You're using PicBasic Pro.
Code:Pattern VAR WORD Idx VAR BYTE ;--------------------------------------------------------------------------- INCLUDE "VirtualPort.bas"; ASM MyPortPins macro ; these define which bits go with which pins Vpin 0, PORTC,5 Vpin 1, PORTC,0 Vpin 2, PORTC,4 Vpin 3, PORTC,1 Vpin 4, PORTC,3 Vpin 5, PORTC,2 Vpin 6, PORTC,6 Vpin 7, PORTB,4 Vpin 8, PORTC,7 Vpin 9, PORTB,6 endm ENDASM ;--------------------------------------------------------------------------- Init: @ OutputPort MyPortPins ; Set Pins to Output Main: FOR Idx = 0 to 38 STEP 2 READ Idx, WORD Pattern ; get pattern from EEPROM @ WritePort _Pattern, MyPortPins ; write pattern to Virtual Port PAUSE 100 NEXT Idx GOTO Main
Last edited by ScaleRobotics; - 2nd September 2011 at 00:56. Reason: Removed B2 pin, wasn't specified originally
DT
Thanks Darrel.
Last edited by ERMEGM; - 16th January 2010 at 20:30. Reason: Darrel posted a reply answering my questions.
OK, having a little difficulty, and can't seem to sort it out. I'm getting a bad expression and an output parameter must be a variable Error on this line:
READ Idx, WORD Pattern ; get pattern from EEPROM
Can't figure it out. What am I doing wrong? This is going on a 16f687 chip.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
I just assumed you had 2.60 because of the WORD modifier in your DATA statements.
You can still use VirtualPort with 2.50b, but getting data from EEPROM will be a little different.
Give this a try...Code:Pattern VAR WORD Idx VAR BYTE ;--------------------------------------------------------------------------- ZigZag DATA %00,%00000001, 2 DATA %00,%00000010, 2 DATA %00,%00000100, 2 DATA %00,%00001000, 2 DATA %00,%00010000, 2 DATA %00,%00100000, 2 DATA %00,%01000000, 2 DATA %00,%10000000, 2 DATA %01,%00000000, 2 DATA %10,%00000000, 2 DATA %01,%00000000, 2 DATA %00,%10000000, 2 DATA %00,%01000000, 2 DATA %00,%00100000, 2 DATA %00,%00010000, 2 DATA %00,%00001000, 2 DATA %00,%00000100, 2 DATA %00,%00000010, 2 DATA %00,%00000001, 2 DATA %00,%00000000, 0 ;--------------------------------------------------------------------------- INCLUDE "VirtualPort.bas" ASM MyPortPins macro ; these define which bits go with which pins Vpin 0, PORTC,5 Vpin 1, PORTC,0 Vpin 2, PORTC,4 Vpin 3, PORTC,1 Vpin 4, PORTC,3 Vpin 5, PORTC,2 Vpin 6, PORTC,6 Vpin 7, PORTB,4 Vpin 8, PORTC,7 Vpin 9, PORTB,6 endm ENDASM ;--------------------------------------------------------------------------- Init: @ OutputPort MyPortPins ; Set Pins to Output Main: FOR Idx = 0 to (19*3) STEP 3 READ Idx, Pattern.HighByte ; get pattern from EEPROM READ Idx+1, Pattern.LowByte @ WritePort _Pattern, MyPortPins ; write pattern to Virtual Port PAUSE 100 NEXT Idx GOTO Main
DT
OK, so I ordered 2.6 and installed it. With some minor tweaking, I managed to get rid of all the error pop ups and get the LEDs to flash. Thank you so much for the translated bits. It works perfectly.
I've started changing some coding around to add some variety to it. Had another questions though. Even though I've labeled the pattern above ZigZag, when you reference the code to look up that pattern, you refer to the memory location. Is this the way it has to be done or can you reference the name ZigZag (or any other name)? I ask only because I am adding other patterns and it can become confusing if I have to count to what each memory position is.
Also, the board I am using has programming ports built onto it, so all I have to do is connect 5 wires from the PCB to the ZIF socket of my PBP. My hardware question is, can I leave all the wires attached after programming the chip on the PCB, or do I have to disconnect them? Was curious if when I turn the flasher on without removing the connections, will it fry anything or cause interference? I've been disconnecting the ZIF socket to prevent any back-flow in case it wasn't protected. It's becoming a real pain if it's not necessary. I just don't want to take a chance on an expensive programmer. As before, thanks in advance.
Tony
Bookmarks