Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:20 11 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Serial Tx CFunction

Author Message
RyanHammond
Newbie

Joined: 29/03/2018
Location: United States
Posts: 15
Posted: 02:13am 06 Apr 2018
Copy link to clipboard 
Print this post

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 Zealand
Posts: 9750
Posted: 03:50am 06 Apr 2018
Copy link to clipboard 
Print this post

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: Australia
Posts: 3308
Posted: 06:04am 06 Apr 2018
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2171
Posted: 07:45am 06 Apr 2018
Copy link to clipboard 
Print this post

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.Edited by CaptainBoing 2018-04-07
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025