Is this possible?


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If all you are wanting to do is make the code readable
    Code:
    ZIG1 VAR PORTC.5
    ZIG2 VAR PORTC.0
    ZIG3 VAR PORTC.4
    You get the picture.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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
    Attached Files Attached Files
    Last edited by ScaleRobotics; - 2nd September 2011 at 00:56. Reason: Removed B2 pin, wasn't specified originally
    DT

  3. #3
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel.
    Last edited by ERMEGM; - 16th January 2010 at 20:30. Reason: Darrel posted a reply answering my questions.

  4. #4
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default

    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.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You have PBP 2.60? Right?
    <br>
    DT

  6. #6
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default

    Aha. 2.50b. Is 2.60 available online to download?

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking ????????????????????

    Quote Originally Posted by ERMEGM View Post
    Aha. 2.50b. Is 2.60 available online to download?
    You are surprising me ...

    PBP NEVER has been on-line downloadable ... honestly.

    See CrownHill or Rentron sites for an official upgrade ...

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ERMEGM View Post
    Aha. 2.50b. Is 2.60 available online to download?
    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

  9. #9
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default

    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

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts