help to display the letter c as in celsius using a max7219

CustomMachine

New Member
I have made up a 3 digit LED display using info from Ron Hackett's Picaxe evil genius book
using the MAX7219 display driver chip
below is some code from Ron's book
I'm using a digital temp sensor and displaying the 2 digit temperature on the first 2 digits
on the 3rd digit I would like to show the letter "c" using segments A,F and G
can anyone please help with this.





Code:
' === Constants ===
' Hardware interface to the MAX7219

symbol load = C.2 ' briefly pulse C.2 to transfer data to LEDs

' Register addresses for the MAX7219
symbol decode = 9 ' decode register; specify digits to decode
symbol brite = 10 ' intensity (brightness) register; 15 = 100%
symbol scan = 11 ' scan-limit register; specify how many digits
symbol on_off = 12 ' 1 = display on; 0 = display off
symbol ones = b2
symbol tens = b3
symbol blank = 15
symbol tempsens = w0  'temperature read from the sensor is stored into vairable w0 called tempsens


' === Directives ===
#com 3 ' specify the com port
#picaxe 20X2 ' specify the PICAXE processor
#no_data ' speed up the download
#no_table ' speed up the download
#terminal off ' disable terminal window

' ============================= Begin Main Program =============================
setfreq m4        'set frequency to 4MHZ   
dirsb = %11111111 ' set portB as all outputs
dirsc = %10011111 ' set portC as outputs (except C.6)    C.5 is the temp sensor
hspisetup spimode00,spifast ' set up hspi





     
     

' Initialize MAX7219
hspiout (scan,2) ' set scan limit for digits 0-3  2 gives us 3 digit display
pulsout load,1
hspiout (brite,2) ' set brightness to 5 (15 = 100%)
pulsout load,1
hspiout (decode,15) ' set BCD decoding for digits 0-3
pulsout load,1
hspiout (on_off,1) ' turn display on
pulsout load,1



temp:
     readtemp C.5,tempsens   ' read the DS18B20 temperature sensor into vairable w0    
     
     'prep the temperature reading into seperate digits
     tens = tempsens / 10
     ones = tempsens // 10'  
     if tens = 0 then
     tens = blank
     endif

               ' Send data to the four digits
                
hspiout (1,tens) ' 1st LED from left  
pulsout load,1
hspiout (2,ones) ' 2nd LED from left    
pulsout load,1
hspiout (3,blank) ' 3rd LED from left    
pulsout load,1



pause 500  '   small delay
goto temp  '   back to temp
 

hippy

Technical Support
Staff member
hspiout (decode,15) ' set BCD decoding for digits 0-3

That rather limits what you can display AIUI; 0 to 9, E, L, H, P, - and blank.

You will have to be in 'no decode' for the display digit, and then it's just a case of sending the correct bits for the display to show the celsius "c".
 

CustomMachine

New Member
Thanks for the pointer hippy

I have now changed decode,15 to decode,3 this put my 3rd digit into its raw mode and then I sent %01000011 to that digit so I show 16 c with the c in the upper part of the display
all good, just need to clean up the code, have just been playing with the 7219 last 2 nights and having fun with Ron's book.
not 100% sure how I came about decode,3 but did try 1 then 2 and finaly 3 worked so using it until I understand it more :)

7219.JPG
 
Last edited:
Top