SERTXD ({#}data,{#}data...)

Data - are variables/constants (0-255) which provide the data to be output.


Serial output via the serial out programming pin.

The sertxd command is similar to the serout command, but acts via the serial output pin rather than a general output pin, and at a fixed baud rate. This allows data to be sent back to the computer via the programming cable. This can be useful whilst debugging data - view the uploaded data in the PICAXE>Terminal window.

There is an option within View>Options>Options to automatically open the Terminal windows after a download.

The # symbol allows ASCII output. Therefore #b1, when b1 contains the data 126, will output the ascii characters "1" "2" "6" rather than the raw data 126. The # symbol can also be used with word, bit and input pin variables.

Serial Baud Rate and Output Format

The baud rate at which a sertxd command sends data depends on the operating speed at the time the sertxd command is executed. The default baud rates is 9600 baud for X2 parts operating at the default 8MHz speed and 4800 baud for non-X2 parts when operating at the default 4MHz speed.

All data bytes sent have 8 data bits, use no partity and have 1 stop bit. This is commonly refered to as "8,N,1" format; 9600,N,8,1 for X2 parts at default speeds, 4800,N,8,1 for non-X2 parts at default speed.

Effect of Increased Clock Speed

Increasing the clock speed increases the serial baud rate as shown below.

4MHz 4800 (default for non-X2 parts)
8MHz 9600 (default for X2 parts)
16MHz 19200
32MHz 38400
64MHz 76800
Applies To:
All (except 08, 18, 28, 28A)
See Also:
Related Create:

Send serial data to a computer

Send the value of b1 in ascii format to a computer connected to the programming connector

Code Example:
main:	for b1 = 0 to 63				; start a loop
	  sertxd("The value of b1 is ",#b1,13,10)
	  pause 1000
	next b1						; next loop
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.