Shop OBEX P1 Docs P2 Docs Learn Events
SPIN and the Scott Edwards serial input LCD. — Parallax Forums

SPIN and the Scott Edwards serial input LCD.

dennodenno Posts: 227
edited 2020-08-22 17:12 in Propeller 1
I was wondering if anyone would be willing to share some SPIN code to use with the 4 X 20 Scott Edwards LCD's which use only SERIAL in. I have done it with various Basic Stamps with SEROUT but need a little help with the Propeller..something simple...LOL

Thanks

Comments

  • Perhaps you should show your working PBASIC code so that it can be translated to Spin. Don't make others guess what you consider "simple."
  • Scott Edwards LCD's serial signal need 5 Volt, I get the signal through a ULN2003A connected to 5V. Then you can use "Debug_Lcd" obj.
  • I have used SEETRON displays with the P1 -- you just need to set the serial object to inverted mode. It does help to bump the signal to 5v, but with many of his displays it's not a requirement. I like the TC4427 as a one-way level-shifter.
  • The following is code in PBAS. I have this running in one COG and the other seven COG's are doing there "thing", and putting data in the HUB and I extract it using RDLONG and put it in the HUB with WRLONG...

    But, I was wondering how I would do it using STRING in SPIN...thank you




    TASK LCD_1  LMM        'this TASK is running in COG 7   
    '========[PIN ASSIGNMENTS]========
      LCD_data_out             PIN   2   
    '========[VARIABLES]===========================
      VOLT           VAR  LONG
      VOLTtenth      VAR  LONG
      VOLThunds      VAR  LONG
      VOLT_12v       VAR  LONG
      VOLTtenth_12v  VAR  LONG
      VOLThunds_12v  VAR  LONG
      MCPValue       VAR  LONG
      TEMP_100       VAR  LONG
      TEMP_10        VAR  LONG
      TEMP_tenths    VAR  LONG
      inDistance     VAR  LONG
      rawHeadingAve  VAR  LONG
      target_dist    VAR  LONG
      target_tenth   VAR  LONG
    '=======================================================================
    'the following DATA statments are to preload the display, the variables are loaded elsewhere in the program.
      LCD_data_0  DATA  clrLCD,backLTon
      PAUSE 100
      LCD_data_1  DATA  posCMD,64,"LDis=",posCMD,74,"TEMP=",0  'LCD...line 1
      LCD_data_2  DATA  posCMD,84,"COMPASS=",posCMD,95,degreeSYM,posCMD,100,"IN'S",0 'LCD...line 2 
      LCD_data_3  DATA  posCMD,104,"VOLTAGE=",posCMD,115,".",posCMD,119,"volts",0
      LCD_data_4  DATA  posCMD,124,"VOLTAGE=",posCMD,135,".",posCMD,139,"volts",0
    
      SEROUT LCD_data_out, baud, LCD_data_0  'clear the screen, beeb, and turn on the back light
      SEROUT LCD_data_out, baud, LCD_data_1  'to print line 1
      SEROUT LCD_data_out, baud, LCD_data_2  'to print line 2
      SEROUT LCD_data_out, baud, LCD_data_3  'to print line 3 
      SEROUT LCD_data_out, baud, LCD_data_4  'to print line 4 
     DO  
    ' A LONG DIATANCE MEASUREMENT
         RDLONG longDistance, target_dist  'reading the distance data that is in the HUB
         PAUSE 50
         RDLONG longDistance_tenth, target_tenth  
         PAUSE 50
    '     IF target_dist < 100 THEN
    '       SEROUT LCD_data_out, baud, beep
    '     ENDIF  
        LCD_data_1a  DATA  posCMD,69,"   ",0
        LCD_data_1a(2) = STR target_dist,3,5
        SEROUT LCD_data_out, baud, LCD_data_1a
    
    ' A COMPASSS ANGLE MEASUREMENT and DISTANCE MEASUREMENT
         RDLONG compassDegrees, rawHeadingAve
         PAUSE 50  'reading the temperature data that is in the HUB
         RDLONG distanceLocation, inDistance
         PAUSE 50
         LCD_data_2a  DATA posCMD,92,"   ",posCMD,96,"   ",0  'to clear previous readings
         LCD_data_2a(2) = STR rawHeadingAve,3,5
         LCD_data_2a(7) = STR inDistance,3,5
         SEROUT LCD_data_out, baud, LCD_data_2a
    ' THIS IS A READING FROM A VARAIBLE 5 VOLT
         RDLONG volt_location, VOLT        'reading the voltage data that is in the HUB
         PAUSE 50'100
         RDLONG tenth_location, VOLTtenth  'reading the voltage data that is in the HUB
         PAUSE 50'100
         RDLONG hunds_location, VOLThunds  'reading the voltage data that is in the HUB
         PAUSE 50'100
    ' THIS IS A READING FROM A LM34
         RDLONG temp_location_100, TEMP_100
         PAUSE 50'100
         RDLONG temp_locationTenths, TEMP_tenths     
         PAUSE 50'100
         LCD_data_1aa  DATA posCMD,79,"  ",posCMD,81,".",posCMD,82," ",posCMD,83,degreeSYM,0
         LCD_data_1aa(2) = STR TEMP_100,2,5
         LCD_data_1aa(9) = STR TEMP_tenths,1,5
         SEROUT LCD_data_out, baud, LCD_data_1aa 
         LCD_data_3a  DATA posCMD,114," ",posCMD,116," ",posCMD,117," ",0
         LCD_data_3a(2) = STR VOLT,1,5
         LCD_data_3a(5) = STR VOLTtenth,1,5
         LCD_data_3a(8) = STR VOLThunds,1,5
         SEROUT LCD_data_out, baud, LCD_data_3a
    ' THIS IS A VOLTAGE MEASUREMENT OF INCOMING SUPPLY VOLTAGE
         RDLONG volt_location_12v, VOLT_12v
         PAUSE 50'100
         RDLONG tenth_location_12v, VOLTtenth_12v
         PAUSE 50'100
         RDLONG hunds_location_12v, VOLThunds_12v
         PAUSE 50'100
         RDLONG MCPValueLocation, MCPValue
         PAUSE 50
    '     IF MCPValue < 9426 THEN '9828/819 = 12.00 volts...beep warning
    '       SEROUT LCD_data_out, baud, beep
    '       PAUSE 100
    '     ENDIF 
         LCD_data_4a  DATA posCMD,133,"  ",posCMD,136," ",posCMD,137," ",0
         LCD_data_4a(2) = STR VOLT_12v,2,5
         LCD_data_4a(6) = STR VOLTtenth_12v,1,5
         LCD_data_4a(9) = STR VOLThunds_12v,1,5
         SEROUT LCD_data_out, baud, LCD_data_4a
     LOOP 
    
    ENDTASK '''LCD_1
    
Sign In or Register to comment.