|
Forum Index : Microcontroller and PC projects : Serial Tx CFunction
| Author | Message | ||||
| RyanHammond Newbie Joined: 29/03/2018 Location: United StatesPosts: 15 |
In the included PDF for the SerialTx function, it states... The SerialTx subroutine (created by adding the above code) takes three parameters: SerialTx( pin, baud-rate, string ) Where pin is the I/O pin baud-rate is the desired transmit speed string is the string of characters to send And the example... SerialTx 2, 19200, "Hello World" Does this mean you can't use a string variable like SerialTx 2, 19200, A$ This could possibly make me weep a bit... |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
No need to weep, you most definitely CAN use a string. I do it all the time using the TXD Cfunction. ![]() That is just an example. I use this in my code: TXD(TX,BAUD,TXT$) I have renamed 'SerialTx' to TXD, but the idea is the same. TX is the pin I want the serial sent on, BAUD is the baud-rate(obviously), and TXT$ is the string to send. Smoke makes things work. When the smoke gets out, it stops! |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
In the documentation string means a string variable, string constant or any expression which returns a string - the are all a string. Same for integer and float. As Grogs said, that was just an example of one type of a string. Geoff Graham - http://geoffg.net |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
It works fine as you need. I use it for my LPrint work-a-like. Couldn't stomach using up a complete serial port where all I need is a single pin... This CFunction is just the ticket. I used the RX counterpart for reading a load of distance sensors that are free-running with a serial output (not the conventional trigger/response type). Just three normal pins and didn't consume any COM port. |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |