shiftout to vfd problem


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42

    Default shiftout to vfd problem

    hi everyone, i have this 20x2 vfd that is driven by four uln5812 vfd drivers. each uln5812 is a 20 bit shift register. two of the drivers take care of the 40 grids, and the other two take care of the 35 segments (5x7 dot matrix). it took me all day to map the bits to segments/grids, and i shifted out static characters on individual grids.

    here's where the fun starts; i need to scan the grids, and this is the approach im trying;
    Code:
     grid var bit[40] 
    
    500 hz interrupt routine pseudocode:
    grid[40] = grid[40] << 1
    will this work? can i shift bits in a 40 bit variable?
    quest two:

    i need to load this 40 bits onto 5 bytes that will be shifted out to the grid drivers:
    Code:
    grid1 var byte
    grid2 var byte
    grid3 var byte
    grid4 var byte
    grid5 var byte
    
    shiftout portd.0, portd.1, msb[grid1\8, grid2\8, grid3\8, grid4\8, grid5\8]
    how do i load the bits in grid[40] onto grid1, grid2, grid3, grid4, grid5?
    in short, what is the easiest way to do a 40 bit scan, and then load it onto the 5 bytes?
    im putting a lot of effort on this code project because i just snagged 16 of this vfd displays at a repo/surplus auction for $5. (they are inside some omni 490 credit card machines). so its worth it. thanks for reading
    NAG CON WIFE!
    WIFE VAR MOOD

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,518


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Create a byte array and index the individual bits in that instead of the other way around. Have a look at Melanies excelent write up on how to access whatever within whatever (almost).

    /Henrik.

  3. #3
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Code:
    grid var byte[5]
    scan var byte
    
    ;timer 0 interrupt routine
    BUTTONS:
    GRID.0(SCAN) = 0
    IF SCAN >= 39 THEN
    SCAN = 0
    ELSE
    SCAN = SCAN + 1
    ENDIF
    GRID.0(SCAN)= 1
    i managed to get this routine to scan the grids, and im able to display characters. however, the above piece of code prevents the program from going to the main program. so im forced to put the whole routine into the "buttons:" interrupt.

    if i comment this exact piece of code, both main and interrupt routines run, but no scanning, ofcourse. i read up on the << shift command, and that can only go from 0 to 31. (i need 40)

    is there any other way to increment the bits in a byte array?
    thanks
    NAG CON WIFE!
    WIFE VAR MOOD

  4. #4
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    i forgot; this is in a 18f4431 running at 40mhz. i also tried all kinds of different speeds, but same results; program on main routine will not run

    Code:
    BUTTONS:
    GRID.0(SCAN) = 0
    IF SCAN >= 39 THEN
    SCAN = 0
    ELSE
    SCAN = SCAN + 1
    ENDIF
    GRID.0(SCAN)= 1
    after more troubleshooting, i found out that its the line highlighted with red that's causing the program not to go to the main loop. any workaround?
    NAG CON WIFE!
    WIFE VAR MOOD

  5. #5
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    Well, dont know if this helps at all, but here is how I did it with a 16 segment 10 character display.

    I created a word size variable for the 16 segments. There was a look up table to determine which segments to light. Lets say that variable is seg

    Then I had 10 bits for the grids, so lets say that was named grid. since it is more than 8 bits I also made that a word variable

    So, to shift out my code I used:

    Shiftout data,clk,mode [seg/16,grid/16]

    Now to make this more applicable lets say I had a VFD with 20 characters on a 10x2 grid. I could name the first 10 grids grid1 and the 2nd 10 grid2

    shiftout data,clk,mode [seg/16,grid1/16,grid2/16]

    That shifts out a total of 48 bits.


    My problem is figuring out how to get the proc to do other tasks while its still shifting out data. I cant recall the whole code right off but if I recall because the pic was doing all the character generation even with it doing nothing but updating the display it would either be too dim or there would be too much flicker.

Members who have read this thread : 1

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