ASCII test generator

mrburnette

Senior Member
UPDATED: 20120907: New code attachment

This post is a summary of my QBF blog. Here I have additionally implemented the "U*" string which is the ASCII equivalent of the old RY Baudot code test.

BLOG entry: QBF

The purpose of this code is to simply have a working serial test generator that can be used to feed a known good signal to the PC or to another PICAXE. There are two unused (currently input) pins and so the program can be enhanced to support a second BAUD rate, 4800 as an example. Another enhancement idea that would require a pin would be to switch modes from send to 'receive' ... compare the pattern coming in with a known good pattern in the EEPROM (transferred to RAM.) Other possibilities abound such as putting in custom strings for testing such things as GPS parsing, etc.

- Ray


Code:
; A Quick Brown Fox ASCII serial test pattern generator
; Public Domain 20120610 by M. Ray Burnette
; 75 bytes / 2048
#picaxe 08m2
#Terminal 9600

SYMBOL CLOCK = m16
SYMBOL BAUDMODE_T	= T9600_16	; Txxx give a true output (idle high) "T=0"
SYMBOL BAUDMODE_N = N9600_16	; Nxxx give an inverted output (idle low) "T=4"
SYMBOL MONITOR	= C.0	; RS232 output on this pin

SYMBOL BAUD		= b0
SYMBOL Looper	= b1
SYMBOL Here		= b2
SYMBOL There	= b3

SetFreq CLOCK
pullup %00011110		; Manual 2 page 159  08M2 bit0-bit4 = C.1 to C.4

; PIN_1 is POSITIVE		PIN_8 is GROUND
; PIN_2 is C.5 is serial_in	PIN_7 is C.0 is serial_out
; PIN_3 is C.4 is future	PIN_6 is C.1 is future
; PIN_4 is C.3 is string sel	PIN_5 is C.2 is HIGH = _N & LOW = _T

BAUD = BAUDMODE_N		; Default to "Inverted" TTL RS232 signaling "idle low"
				; Swap to _T mode if indicated
IF PINC.2 = 0 then	; IS the Physical pin #5 0n 08M2 at ground?
	BAUD = BAUDMODE_T	; Default to "Inverted TTL RS232 signaling "idle high"
ENDIF

; Example: For Scott Edwards display: BAUD = BAUDMODE_N
; Example: For SparkFun display:      BAUD = BAUDMODE_T
; Example: For PC Hyperterminal:      BAUD = BAUDMODE_N
; The defaults should allow the chip to communicate with the PC

PAUSE 8000
DISCONNECT			; Stop polling for Serial Input

; Load higher RAM memory with EEPROM string
bptr = 28			; BANK 0 == addresses 0 --> 27 for Named Variables
; Default to EEPROM containing string Quick Brown Fox
Here = 0
There = 63

IF PINC.3 = 0 then	; If Physical pin #4 is grounded, alternate string
	Here = 64
	There = 127
EndIF

For b1 = Here to There	; Load EEPROM into RAM
	READ b1, @bptrinc
Next b1

; Spool string from RAM forever...
Do
	bptr = 28
	For b1 = 0 to 64
		serout MONITOR, BAUD, (@bptrinc)
	Next b1
	serout MONITOR, BAUD, (CR, LF)
	Pause 1000
Loop

' 64 Bytes
; "$" included for future enhancement to allow qualifier testing
EEPROM 0, ("$The Quick Brown Fox Jumped Over The Lazy Dogs Back.0123456789!#")
EEPROM 64,("U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*U*")

; IDEAS for future enhancements
; PIN3 port C.4 selection for Output (default) and Input (receiving on Pin2)
; PIN6 port C.1 selection for an alternate BAUD, perhaps 4800
QBF.JPG

20120907: Update to code to allow dual-baud 9600/4800 and dual protocol _N/_T and dual messages which can all be reset while the PICAXE is powered. There is now 1 spare PIN that could be used to effect a new option... perhaps 4 BAUD speeds instead of the 2 now implemented.

View attachment 20120907 _08M2_QBF.zip
 
Last edited:
Top