Propbasic and SEROUT...
denno
Posts: 223
First of all, I am not sure on how to post code, other then copy and paste here...so forgive me on that one....The .pbas below, does compile and the LED's do blink as indicated, however, I cannot get the SEROUT to work to a Scott Edwards 4X20 display. I have used many of these displays over the years with the Basic Stamp, with excellent results...Does anyone have any ideas on this...?
DEVICE P8X32A, XTAL1, PLL16X XIN 5_000_000 baud CON "T9600" carr_return CON 13 clrLCD CON 12 'clear the screen on the lcd posCMD CON 16 'position the curser command hideCUR CON 4 'hide the curser command blinkCUR CON 6 'blink the curser command degreeSYM CON 223 'the "degree" symbol receive_data CON 255 backLTon CON 14 'turn the back light on backLToff CON 15 'turn the back light off brightness_ctl CON 27 quarter_bright CON 48 half_bright CON 49 three_quarter_bright CON 50 full_bright CON 51 beep CON 7 'beep command right_align CON 18 'RIGHT ALIGN COMMAND start_big_char CON 2 end_big_char CON 3 astrike CON 42 block_char CON 134 carReturn CON 13 'carriage return command blank_char CON 32 left_arrow CON 127 right_arrow CON 126 LR_arrow CON 131 LL_arrow CON 128 UR_arrow CON 129 UL_arrow CON 130 down_arrow CON 132 up_arrow CON 133 equal_sign CON 61 first_line CON 64 second_line CON 104 message DATA “Hello There.” flash_16_LED task flash_17_LED task flash_18_LED task LCD task pause 100 PROGRAM Start Start: COGINIT Flash_16_LED, 2 ' Start task in COG 2 COGINIT Flash_17_LED, 3 COGINIT Flash_18_LED, 4 COGINIT LCD,5 END '''''''' TASK LCD LCD_data_out PIN 0 OUTPUT SEROUT LCD_data_out, baud, beep SEROUT LCD_data_out, baud, message ENDTASK ''''''' TASK flash_16_LED LED_16 PIN 16 LOW DO TOGGLE LED_16 PAUSE 200 LOOP ENDTASK ''''''' TASK Flash_17_LED LED_17 PIN 17 LOW DO TOGGLE LED_17 PAUSE 400 LOOP ENDTASK '''''' TASK Flash_18_LED LED_18 PIN 18 LOW DO TOGGLE LED_18 PAUSE 1000 LOOP ENDTASK
Comments
Check out the 3 attached images. Do they help explain ?
Click the "C" button to get code tags, then type your code (or copy/paste code) between those tags.
EDIT @VonSzarvas beat me to it.
Check the PropBasic user guide explanation of the SEROUT baud parameter, and make sure that's correct for compatibility with the Scott Edwards module.
There are a couple different operation modes (T and O as I recall), different baud rates, and also different ways to make the connections between the devices (like with a pull-up or pull-down resistor, or without any pull resistor).
Perhaps you have the baud rate correct as you've been using the modules before, but the other settings are less obvious and might differ from how it worked with Basic Stamp. So this might be a place to start investigating.
So in the TASK make the line HIGH then wait a couple milliseconds before sending commands.
PropBASIC super fast compared to a Basic Stamp. You may have to put some delays in after the BEEP.
Bean
Bean
Mouser, Digikey, etc., have dozens if not hundreds of different kinds.
Mike R...
However, I cannot get .PBAS to write to the same LCD. Which, makes me wonder if I have the latest version of .PBAS. The .PBAS manual is version, 1.48, but I think the IDE, I have is 1.43. How do I tell for sure, and has anyone used an LCD in .PBAS, and if so, do you have any example codes...?
Thanks...DennO