Hi ! I made this schematic : http://solderslingers.com/cart/index...&products_id=1 and work very fine ! So, since I am "0" in Atmel programming, I try to write my own program for PIC, using PBP (here am I to "1" level :) and example from this forum- Thanks to Mr.D.J.Welburn !
But...of course, I need help. Only 4 columns are lighting and the characters are ...strange, non-readable. It's some "moving" on my led matrix, but sure it's something wrong. I need help ! Thanks in advance !
Code:@ DEVICE pic16F628A, intOSC_osc_noclkout, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON
define osc 4
INTCON = 0
TRISA= %00000000
TRISB= %10000000
DQ var PortB.7
CMCON=7 ' Disable comparators
'***************************************************************************************
eeprom 0, [%00111110,%01010001,%01001001,%01000101,%00111110] '0
eeprom 5, [%00000000,%01000010,%01111111,%01000000,%00000000] '1
eeprom 10,[%01000010,%01100001,%01010001,%01001001,%01000110] '2
eeprom 15,[%00100001,%01000001,%01000101,%01001011,%00110001] '3
eeprom 20,[%00011000,%00010100,%00010010,%01111111,%00010000] '4
eeprom 25,[%00100111,%01000101,%01000101,%01000101,%00111001] '5
eeprom 30,[%00111100,%01001010,%01001001,%01001001,%00110000] '6
eeprom 35,[%00000001,%01110001,%00001001,%00000101,%00000011] '7
eeprom 40,[%00110110,%01001001,%01001001,%01001001,%00110110] '8
eeprom 45,[%00000110,%01001001,%01001001,%00101001,%00011110] '9
counter var byte
scan var byte
scroll var byte
leddata var byte[36] 'Column Data for display 36 columns
temperature var Word 'reading from sensor
Sign var BIT
tempA var byte 'Stores First digit (High)
tempB var byte 'stores Second digit (Mid)
tempC var byte 'stores Third digit (low)
DS18B20_12bit CON %01111111
START:
CLEAR 'Clear all varibles
' Init Sensor 1
OWOUT DQ, 1, [$CC, $4E, 0, 0, DS18B20_12bit]
OWOut DQ, 1, [$CC, $48] ' Start temperature conversion
OWOut DQ, 1, [$CC, $B8]
OWOut DQ, 1, [$CC, $BE]
Pause 50
OWIn DQ, 2, [temperature.byte0, temperature.byte1]
Pause 50
'leddata locations 0-7 are blank so that data scrolls onto display
'leddata locations 8-12 1st digit (leading digit)
'leddata location 13 blank column between digits
'leddata locations 14-18 2nd digit
'leddata location 19 blank column between digits
'leddata locations 20 & 21 Decimal Point
'leddata locations 23 - 27 3rd digit (last digit)
'leddata locations 28 blank column between digits
'leddata locations 29 - 34 Degrees C symbol
'leddata location 35 is a blank column at end to clear display as it scrolls
leddata [20] = %11000000 ' DECIMAL POINT
leddata [21] = %11000000
leddata [29] = %00000011 ' degrees c
leddata [30] = %00000011
leddata [31] = %00111000
leddata [32] = %01000100
leddata [33] = %01000100
leddata [34] = %01000100
OWOut DQ, 1, [$CC, $44]
OWOut DQ, 1, [$CC, $BE]
OWIn DQ, 2, [temperature.byte0, temperature.byte1]
Sign = temperature.15
temperature= ABS(temperature)
temperature=((temperature >> 4)*100) + ((temperature & $F) * 100 >> 4)
if sign then temperature= -temperature
tempA = temperature DIG 2
tempB = temperature DIG 1
tempC = temperature DIG 0
IF tempA = 0 THEN ' if 1st digit is 0 then skip so display dosnt display 09.5c
GOTO skipdigit ' it will display 9.5c instead
ENDIF
FOR counter = 0 TO 4
READ tempA*5+counter,leddata [counter+8] 'stores 1st digit in leddata locations 8,9,10,11,12
NEXT counter
skipdigit:
FOR counter = 0 TO 4
READ tempB*5+counter,leddata [counter+14] 'stores 2nd digit in leddata locations 14,15,16,17,18
NEXT
FOR counter = 0 TO 4
READ tempC*5+counter,leddata [counter+23] 'stores 3rd digit in leddata locations 23,24,25,26,27
NEXT
LOOP:
FOR scroll = 0 TO 35
FOR scan = 0 TO 15
PORTA = 1
FOR counter = 0 TO 7
PORTB = leddata [counter]
PAUSEUS 1500
PORTB = 0
PORTA = PORTA * 2
NEXT
NEXT
FOR counter = 0 TO 34
leddata [counter] = leddata [counter+1]
NEXT
NEXT
GOTO START
END