Can't get 1 wire serial LCD to work with SX48
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 :
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
Try OSCHS1, OSCHS2 or OSCHS3.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·