Hello everyone,
About Baudmode, is there a way to use T9600 instead of 16780.
or this is the way the compiler work.
Thanks
The Baudmode is a value base upon a calculation used in the old BASIC Stamp 2 devices's serial commands, so to give the value a name, create it as an aliased constant value. For example:
Symbol T300 = 3313
Symbol N300 = 3313 + $4000
Symbol T600 = 1646
Symbol N600 = 1646 + $4000
Symbol T1200 = 813
Symbol N1200 = 813 + $4000
Symbol T2400 = 396
Symbol N2400 = 396 + $4000
Symbol T4800 = 188
Symbol N4800 = 188 + $4000
Symbol T9600 = 84
Symbol N9600 = 84 + $4000
Symbol OT2400 = 396 + $8000 ' Open True
Symbol OT1200 = 813 + $8000 ' Open True
Symbol OT9600 = 84 + $8000 ' Open True
Symbol OT300 = 3313 + $8000 ' Open True
Symbol ON2400 = 396 + $4000 + $8000 ' Open Inverted
Symbol ON1200 = 813 + $4000 + $8000 ' Open Inverted
Symbol ON9600 = 84 + $4000 + $8000 ' Open Inverted
Symbol ON300 = 3313 + $4000 + $8000 ' Open Inverted
If the program only requires a single serial input/output, I recommend using the RSIn and RSOut commands instead of the Serin and Serout commands, because they are more streamlined. And if the device contains a UART or USART, use the HRSout/HRSin or HSerin/HSerout commands.
much appreciate
Thanks Top204
it for an serial LCD +,-,rx like the FRM010 from Picaxe or the LCD117 from Modern Device
Hi JackB.
There is a very good manual included with Positron.
It already contains a lot of information about the things you ask, such as the baudrate calculation for SERIN, RSIN, SEROUT and RSOUT.
Hello Frizie
I'm on right now, reading about serial com.
very interesting to read.
soon I'll be ready to write some code for my seral LCD and see the reaction.
Thanks Frizie, have a good day.
In order to use the RSOut command, you can use something like the code snipped below, but change the setups for the device you are using:
'
' /\\\\\\\\\
' /\\\///////\\\
' \/\\\ \/\\\ /\\\ /\\\
' \/\\\\\\\\\\\/ /\\\\\ /\\\\\\\\\\ /\\\\\\\\ /\\\\\\\\\\\ /\\\\\\\\\\\ /\\\\\\\\\
' \/\\\//////\\\ /\\\///\\\ \/\\\////// /\\\/////\\\ \////\\\//// \////\\\//// \////////\\\
' \/\\\ \//\\\ /\\\ \//\\\ \/\\\\\\\\\\ /\\\\\\\\\\\ \/\\\ \/\\\ /\\\\\\\\\\
' \/\\\ \//\\\ \//\\\ /\\\ \////////\\\ \//\\/////// \/\\\ /\\ \/\\\ /\\ /\\\/////\\\
' \/\\\ \//\\\ \///\\\\\/ /\\\\\\\\\\ \//\\\\\\\\\\ \//\\\\\ \//\\\\\ \//\\\\\\\\/\\
' \/// \/// \///// \////////// \////////// \///// \///// \////////\//
' Let's find out together what makes a PIC Tick!
'
' Written for the Positron8 compiler by Les Johnson.
'
Device = 18F25K20 ' Tell the compiler what device to compile for
Declare Xtal = 16 ' Tell the compiler what frequency the device will be operating at (in MHz)
'
' Setup RSout
'
Declare RSOut_Baud = 9600 ' Set the Baud rate to 9600
Declare RSOut_Mode = True ' True mode
Declare RSOut_Pin = PORTC.6 ' Set the TX pin
'
' Create some defines for the LCD
'
$define LCD_117_Home_Cursor "?a"
$define LCD_117_Destructive_Backspace "?b"
$define LCD_117_Cursor_Style_None "?c0"
$define LCD_117_Cursor_Style_Blink "?c2"
$define LCD_117_Cursor_Style_Underline "?c3"
'----------------------------------------------------------------------------
' The main program starts here
'
Main:
RSOut LCD_117_Home_Cursor
RSOut LCD_117_Cursor_Style_Blink
RSOut LCD_117_Cursor_Style_Underline
It is a lot better, and a lot more efficient than having to constantly set the pin and Baud for a command that is always sending from the same pin at the same Baud rate, as would apply to the Serout command.
Also note the $defines I created when looking at a page for the LCD_117 device's commands. They could be elaborated on more so it is clearer what a command to it is doing.
But I have to add that the LCD_117 is a bit short on thought put into its commands, and very cumbersome. Why not just make the serial interface talk directly to the LCD, as I did many years ago with a serial LCD unit I designed for "them", then the control of it is very fluent. That is why I actually added the 'At ' and 'Cls 'directives to the RSOut and HRSOut commands, so a serial LCD could be interfaced too directly as if it was an LCD connected normally. The Baud was set by a couple of jumpers on the PCB.
For example:
RSOut Cls
RSOut At 1, 1, "Hello World"