Shop OBEX P1 Docs P2 Docs Learn Events
Can't get 1 wire serial LCD to work with SX48 — Parallax Forums

Can't get 1 wire serial LCD to work with SX48

eagletalontimeagletalontim Posts: 1,399
edited 2009-05-30 05:13 in General Discussion
Well, I am back at it again. I got my SX48 proto boards in and I am trying to start out with just the basics before I get into heavy coding. First off is the 1 wire serial display. I am using the Parallax 1 wire serial display found here : http://www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/Level/a/ProductID/52/Default.aspx?SortField=ProductName,ProductName

Now here is the strange part. I was running an SX28 at 5 mhz and it run everything perfect with the exact same LCD code. I am attempting to run the SX48 at 50 mhz so my timing is more precise.

Here is my code :

DEVICE          SX48, OSCXT2
FREQ            50_000_000

LcdTx        PIN    RA.0

LcdBaud        CON    "T19200"        ' or T2400, or T9600
LcdBkSpc        CON     $08                 ' move cursor left
LcdRt           CON     $09                 ' move cursor right
LcdLF           CON     $0A                 ' move cursor down 1 line
LcdCls          CON     $0C                 ' clear LCD (need 5 ms delay)
LcdBLon         CON     $11                 ' backlight on
LcdBLoff        CON     $12                 ' backlight off
LcdOn1          CON     $16                 ' LCD on; no crsr, no blink
LcdLine1        CON     $80                 ' move to line 1, column 0
LcdLine2        CON     $94                 ' move to line 2, column 0

temp1        VAR    Byte            ' subroutine work vars
temp2        VAR    Byte
temp3        VAR    Byte
idx         VAR     Byte             ' loop counter
line1         VAR     Byte(16)         ' line 1 buffer
line2         VAR     Byte(16)         ' line 2 buffer

PROGRAM Start

wait        SUB    1, 2            ' delay in milliseconds
LCD_OUT        SUB    1, 2            ' send byte {+ count} to LCD
UPDATE_L1     SUB     0             ' update line 1 of LCD
UPDATE_L2     SUB     0             ' update line 2 of LCD

Start:
  PLP_A = %0001                    ' pull up unused pins
  PLP_B = %0000_0001
  TRIS_C = %00000000 
  TRIS_D = %00000000
  TRIS_E = %00000000
  HIGH LcdTx
  wait 50                    ' let LCD initialize
  LCD_OUT LcdOn1                ' no cursor or blink
  LCD_OUT LcdCls                ' clear the LCD
  wait 5
  PUT line1, "This is line 1"
  PUT line2, "This is line 2"
  UPDATE_L1
  UPDATE_L2

Main:

  GOTO Main

wait:
  temp1 = __PARAM1                              ' get milliseconds
  IF __PARAMCNT = 1 THEN                        ' if no multiplier
    temp2 = 1                                   '   set to 1
  ELSE                                          ' else
    temp2 = __PARAM2                            '   get multiplier
  ENDIF
  IF temp1 > 0 THEN                             ' no delay if either 0
    IF temp2 > 0 THEN
      PAUSE temp1 * temp2                       ' do the delay
    ENDIF
  ENDIF
  RETURN

UPDATE_L1:
  LCD_OUT LcdLine1
  wait 5
  FOR idx = 0 TO 15
    LCD_OUT line1(idx)                 ' transfer buffer
  NEXT
  RETURN

UPDATE_L2:
  LCD_OUT LcdLine2
  wait 5
  FOR idx = 0 TO 15
    LCD_OUT line2(idx)                 ' transfer buffer
  NEXT
  RETURN

LCD_OUT:
  temp1 = __PARAM1                 ' char to send
  IF temp1 = $00 THEN
    SEROUT LcdTx, LcdBaud, " "
  ELSE
    SEROUT LcdTx, LcdBaud, temp1        ' transmit to LCD
  ENDIF
  RETURN

Comments

  • BeanBean Posts: 8,129
    edited 2009-05-24 16:27
    I don't think the SX48 will run at 50MHz using OSCXT2.
    Try OSCHS1, OSCHS2 or OSCHS3.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...

    ·
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-05-24 16:47
    Just tried it and it still did not work [noparse]:([/noparse] I hope I did not burn up the display. I think the serial wire may have touched the 5v source awhile back. If i set the display into test mode, it prints the Parallax info but if i put it in any other mode, it show a non blinking cursor on line 1. I even tried the demo script that is on the product page and it just showed a cursor as well. Looks like I am going to have to order another screen [noparse]:([/noparse]
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-05-25 03:28
    busy flag? Could you explain that or show a sample code if you don't mind?
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-05-25 15:26
    ok, I am really thinking the lcd is fried. I tried the demo code on an sx28 again and it did not work at all [noparse]:([/noparse]
  • JonnyMacJonnyMac Posts: 9,213
    edited 2009-05-25 19:14
    Before you get too hasty and chuck your LCD you might try the attached demo -- it's setup for the SX48 but I wrote it and tested it on the 28, so you can go back easily (I'm running it on an SX52 right now so I know it works on both chips). This demo takes advantage of SX/B 2.0 features and includes formatting routines that you'll probably want to have in your end program.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2009-05-30 05:13
    Just tried it and still got a solid cursor on line one [noparse]:([/noparse] I guess it is really shot.
Sign In or Register to comment.