Is this possible?


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    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

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


    Did you find this post helpful? Yes | No

    Default

    Yes, you can reference them by name.

    Code:
    Sequence VAR BYTE
    
    Sequence = ZigZag
    GOSUB RunSequence
    
    Sequence = Marquee
    GOSUB RunSequence
    Each sequence will probably be a different length, so you might have the first byte indicate the length, then delete all those 2's.
    <br>
    DT

  3. #3
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default

    OK, not quite understanding completely when you say that. I've changed the code around a bit, so I guess that's why it doesn't make much sense. I've done this so far:

    Code:
    ZigZag          DATA    Word %0000, 100
                    DATA    Word %0001, 100
                    DATA    Word %0010, 100
                    DATA    Word %0100, 100
                    DATA    Word %1000, 100
                    DATA    Word %0000, 100
                    DATA    Word %1000, 100
                    DATA    Word %0100, 100
                    DATA    Word %0010, 100
                    DATA    Word %0001, 100
                    DATA    Word %0000, 100
                    DATA    Word %0000, 0
    Later in the code, I have this:

    Code:
    Main:
    
        Idx = 0
    
    repeat
    
            READ Idx, WORD Pattern, timer      ; get pattern from EEPROM
            IF (timer > 0) THEN
    @       WritePort  _Pattern, MyPortPins    ; write pattern to Virtual Port
            PAUSE timer
            Idx = Idx + 3
            endif
            
    until timer = 0
    goto Main
    I've added a more complex code after this so as to be able to take a small segment from above and create a variable to the FOR-NEXT loop to be able to increase repetitions without having to write additional 1s and 0s.

    In essence, it is to simulate:
    Code:
    FOR x = 1 to reps
    
    high 1
    pause 100
    low 1
    pause 100
    
    NEXT x
    
    FOR x = 1 to reps
    
    high 2
    pause 100
    low 2
    pause 100
    
    NEXT x
    Where "reps" can be incremented to create multiple flashes and still not take up additional space. It won't be getting it's code from ZigZag, but rather another "baseline" of code. I have other additional patterns in mind that will be its own entity like ZigZag, but wanted to be able to call it. This is where I'm a little confused as far as listing the length of code in the first byte.

    Thanks,
    Tony

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


    Did you find this post helpful? Yes | No

    Default

    I was thinking that at the beginning of the sequence you could put the length and the period just before the data. The entire sequence would have to be the same speed, but it saves a bunch of EEPROM.

    Code:
    ZigZag
                    DATA    12, 100       ; length, speed
                    DATA    Word %0000
                    DATA    Word %0001
                    DATA    Word %0010
                    DATA    Word %0100
                    DATA    Word %1000
                    DATA    Word %0000
                    DATA    Word %1000
                    DATA    Word %0100
                    DATA    Word %0010
                    DATA    Word %0001
                    DATA    Word %0000
                    DATA    Word %0000
    Then you do 12 loops with a PAUSE 100 in each loop.
    May be more limiting than what you have though.

    P.S. You can store the sequences in Flash memory instead of EEPROM, and you'll have a lot more room. (not much more with a 16F687 though)
    Last edited by Darrel Taylor; - 27th January 2010 at 04:19. Reason: P.S.
    DT

  5. #5
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default

    OK. That makes more sense. So, correct me if I'm wrong, but the chip writes ZigZag at a specific memory location (the next one available) and Marquee at the next available after ZigZag and so on. It is called up by referencing the name and not having to reference the location (i.e. read 0 or read 13...). The first line of DATA code is the seed for the loop (run this many times and delay this many milliseconds). Is this a correct interpretation?

    Also, when you wrote the code:
    Code:
    @       WritePort  _Pattern, MyPortPins    ; write pattern to Virtual Port
    This doesn't actually write to the chip does it? I only ask because, as you know, chips have only so many write functions and the patterns I am writing will meet that limit in a short time. I'm assuming NO, but you never know.

    Thanks,
    Tony

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


    Did you find this post helpful? Yes | No

    Default

    Sounds like you've got it, on the first part.

    And WritePort just writes to the PINs.
    It doesn't write to Flash memory.

    Cheers,
    DT

  7. #7
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default Posting code

    Darrel T

    I've noticed that when you post code here it is always neatly laid out - upper/lower case correct and tidily tabbed.

    When I cut/pase code here it looks a mess - the upper/lower case is what I typed and the tabs go adrift.

    How to you do it?

    Regards Bill Legge

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