Shop OBEX P1 Docs P2 Docs Learn Events
Variable's Nibbles Copied Onto Pins — Parallax Forums

Variable's Nibbles Copied Onto Pins

John KauffmanJohn Kauffman Posts: 653
edited 2008-03-26 11:04 in General Discussion
Variable's Nibbles Copied Onto Pins
·
I am trying to get the Parallax LCD AppMod to work with an SX (Tech Tool). The SX/B help example uses 8 wire bus, but the AppMod is supposed to work on 4 wire bus as well. An earlier post helped with the masking technique.
·
I built a cable/adaptor that connects equivalent number pins from AppMod header to the SX RB pins.
·
In the SX/B program the character to display is held in a byte variable named Char as an ASCII value. The LCD AppMod expects to get that a byte across a 4-wire bus (RB.4-RB.7) in two reads: one read for the high nib and then a second read to get the low nib.
·
I see the masking ·/ swap trick to get the nibbles, but I don't see how to copy that value from the variable onto the four bus pins. It seems there should be a way to set the top four pins of RB to be equal to the masked value in Char. Is the syntax something like the lines that start with ???
·
Char················ var······ byte
??? LcdBusOut··········· var······ RB.high
·
Char = %10000001···· ' = 65 = "A"
·
??? LcdBusOut = Char & $F0 ' put value of Char high nibble into bus pins
PULSOUT LcdEnable, 3 ······· ··········· ' Tell the AppMod to read the data bus
SWAP Char···························· ··········· ' swap low & high nib
??? LcdBusOut = Char & $F0 ' put value of Char low nibble into bus pins
PULSOUT LcdEnable, 3 ······· ··········· ' Tell the AppMod to read the data bus
·
THanks.

Comments

  • BeanBean Posts: 8,129
    edited 2008-03-26 11:04
    John,
    · SX/B does not have a "Nibble" variable·type.

    · You'll need to do it in several steps.

    LcdBusOut       PIN       RB
     
    char                 VAR       BYTE
    
    temp                VAR       BYTE 
      
      
    Char = "A"  
      
    temp = char & $F0                              ' Get high bits of char 
    LcdBusOut = LCDBusOut & $0F       ' Mask off high bits 
    LcdBusOut = LcdBusOut | temp          ' Put value of Char high nibble into bus pins 
    PULSOUT LcdEnable, 3                     ' Tell the AppMod to read the data bus 
      
    SWAP Char                                         ' Swap low & high nib 
    temp = char & $F0                               ' Get high bits of char 
    LcdBusOut = LCDBusOut & $0F        ' Mask off high bits 
    LcdBusOut = LcdBusOut | temp           ' Put value of Char high nibble into bus pins 
    PULSOUT LcdEnable, 3                      ' Tell the AppMod to read the data bus
    

    ·
    ·Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com



    Post Edited (Bean (Hitt Consulting)) : 3/26/2008 11:13:54 AM GMT
Sign In or Register to comment.