Software Programming in PicAxe BASIC

You are in home \ microcontroller \ PicAxe \ PicAxe BASIC Programming (back)  

PicAxe pages: Picaxe General   Wiring up the Picaxe   Programming the Picaxe   Projects  
Software

Intro.

Input &
Output

Branching
& Jumping

Looping

Serial
comms.

Picaxe code
to html
converter

   
 

PicAxe BASIC - Serial Communications

This program uses the serial data circuit on the serial hardware page, which is part of the first Picaxe circuit I built.
'---[program description]---
' After an initial countdown to give 
' user time to hit F-8 and remove jumper, 
' The main routine waits for serial chars in, 
' and echoes them back to the terminal. 

'---[memory usage]---
' b0 = loop var used locally (ie. reusable) 

'---[declarations]---
symbol readpin = 3	'serin on pin 3 (Leg 4). 
symbol getchar = b3


'---[init]---
	serout 0,N2400,($0D, $0A)
	serout 0,N2400,("Jmpr off !")

	for b0 = 9 to 0 step -1
	  serout 0,N2400,(#b0)
	  pause 1000
	next b0	

	serout 0,N2400,(" Echoing... ",$0D, $0A)


'---[main]---------------------------------
main:
	serout 0,N2400,(" > ")
	serin readpin,N2400,b3
	goto main

'-------------------------------------------