Thanks Charles for your subroutines.
This is a snippet of code from a two temperature probe controller, chiller and alarm
Alarm MIN and MAX
Chiller MIN and MAX
Crammed it into a 12f1822, should of used a 12f1840
for more space.
Use gosub Print_Phrase: with zb pointing to the string.
eg zb= Ofuzzy1 : gosub Print_Phrase
will print out the copyright string:
(C)2011 Ofuzzy1 All Rights Reserved - Not for Life Critical Use!
Was cramped for space so phrases were pieced together.
MIN Alarm would be pieced together
Print_Alarm_Min:
gosub Print_Alarm: gosub Print_Min:
return
'================================================= =====================================
Code:
; Strings are stored in the EEPROM leaving more room for Programs
; The last char of the string has $80 added to it mark then end of the string.
; this simplifies string maintenance.
; Strings are sent out via DEGUG for Async Serial - RS232
; Debug is smaller than serout and serout2
' print character defines
CR con 13
LF con 10
VTAB CON 11 ' VERTICAL TAB = Clear Screen
DEGREE CON $DF
Dash con 45
Space con $20
' ---- The temps they do all the grunt work with little or no pay :)
AB VAR BYTE ' TEMP
BB VAR BYTE ' TEMP
xb var byte ' temp
yb var byte ' temp
zb var byte ' temp
' These are stored on the EEPROM Data area -- Leaves room for bigger programs
' *** Mark the end of the words with Char + 128
; @$10 starts the strings at location $10 [16] in the eeprom
CharBump con $80
Ofuzzy1 data @$10, "(C)2011 Ofuzzy1 All Rights Reserved - Not for Life Critical Use", "!" + CharBump
W_Alarm Data "Alarm", "_" + CharBump ; Alarm
W_Min Data "Mi", "n" + CharBump ; Min
W_Max Data "Ma", "x" + CharBump ; Max
W_Normal Data "Norma", "l" + CharBump
W_Both_Probes Data "Both Probe", "s" + CharBump
W_Enter Data "& Ente", "r" + CharBump
W_YNRQ Data "Y=Yes R=Redo N=No Q=Qui", "t" + CharBump
'===========================================================================
; begin MAIN program code
Gosub Print_Copyright
End
;end MAIN program code
===========
Print_Copyright:
gosub CR_LF3 ': gosub CR_LF
zb= Ofuzzy1 : gosub Print_Phrase
gosub CR_LF3 ': gosub CR_LF
return
'======================================================================================
Print_Phrase: ' Call with zb = ROM_Memory_Location [byte] last char is >$80
bb = 1 ' this could be re-written slicker but it works.
Do until !BB ' = 0
read zb, ab
if ab > CharBump-1 then
ab = ab - CharBump
bb = 0
endif
debug ab
zb= zb + 1
loop
return
'======================================================================================
CR_LF3: ; 3 line feeds
debug LF,cr
CR_LF2: ; 2 line feeds
debug LF,cr
CR_LF:
debug CR,LF ; 1 line feed
return
'======================================================================================
Print_SP2:
debug " "
Print_SP:
debug " "
return
'======================================================================================
Print_LT:
gosub Print_SP : gosub Print_lt1: gosub Print_SP
return
'======================================================================================
Print_LT1:
debug "<":
return
'======================================================================================
Print_GT:
gosub Print_SP : gosub Print_GT1: gosub Print_SP
return
'======================================================================================
Print_GT1:
debug ">":
return
'======================================================================================
Bookmarks