Serial Connector (MAX232)



Output serial via a MAX232

The following program will output serial data at 2400 baud which reports the incrementing value of the byte variable 'b0' every second. As the serial signal goes through a MAX232 which inverts the signal a 't2400' baud rate is used and the output is set high before the first 'serout' command is issued. Because an 8-bit byte variable is used, after the number reaches 255, the next increment will take its value to zero.

Code Example:
	high B.1				; Initialise output B.1 for 't2400' serial
	pause 10				; Delay while the receiver prepares for data 

main:	serout B.1, t2400, ( #b0, CR, LF )	; Output a number value
	pause 1000				; Wait for 1 second
	b0 = b0 + 1				; Next number to output
	goto main				; Output the next number
Copy Code Submit an Example

Create Module

No Image Selected

Bill of Materials

MAX3232CPE / SP3232EUCP ICO031 1 Buy Now
16-pin 0.3" DIP IC Socket ICH016 1 Buy Now
100nf miniature polyester capacitors CAP001 4 Buy Now


No Image Selected

Submit Your Own Code!

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