Need DAT table help please
Don M
Posts: 1,653
I am trying to make this dat table work for a custom character on a serial display. If the individual lines of bytes that are commented out are sent to the display, they work. I was trying to make a table to simulate the individual lines and be able to send it all at once. What am I doing wrong here?
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 TX_PIN = 8 BAUD = 19_200 OBJ LCD : "FullDuplexSerial.spin" PUB Main LCD.start(TX_PIN, TX_PIN, %1000, 19_200) waitcnt(clkfreq / 100 + cnt) ' Pause for FullDuplexSerial.spin to initialize LCD.tx(250) ' Define custom character 2 LCD.tx(@up_arrow) ' LCD.str(string(250, @up_arrow)) ' Now send the eight data bytes { LCD.tx(%00100) LCD.tx(%01110) LCD.tx(%11111) LCD.tx(%00100) LCD.tx(%00100) LCD.tx(%00100) LCD.tx(%00100) LCD.tx(%00100)} LCD.tx(2) ' Display the new custom character 2 { LCD.tx(251) ' Define custom character 3 LCD.tx(%00100) LCD.tx(%00100) LCD.tx(%00100) LCD.tx(%00100) LCD.tx(%00100) LCD.tx(%11111) LCD.tx(%01110) LCD.tx(%00100) } ' LCD.tx(3) dat up_arrow byte %00100 byte %01110 byte %11111 byte %00100 byte %00100 byte %00100 byte %00100 byte %00000 dn_arrow byte %00100 byte %00100 byte %00100 byte %00100 byte %11111 byte %01110 byte %00100 byte %00000
Comments
Is the definition data always of a fixed size (i.e. 8 bytes)? What about something like this then: This could easily be wrapped up in a method taking prefix, suffix and address as parameters, e.g.
You pass the custom character # and the address of the DAT table holding the definition bytes. You can't use .str() as this is terminated by 0 in the stream; this could cause too few bytes to be sent or too many (if no blank line in character).