PDA

View Full Version : 8x8 Scrolling LED display (Simple example)



wellyboot
- 23rd March 2009, 09:48
Hello,

I have built a simple 8x8 LED matrix that scrolls a message, in my example i am scrolling " D J W " followed by a smiley face.

I used standard yellow leds, which are ok, I would however recomend using higher brightness leds and adjusting the PORTB output resistors to suit.

I have attached a text file of code, I warn you now im no expert at writting code and not as experienced as some guys on here are, i have based it around 16F872 as i had 1 handy, and hope someone finds it useful!

Ill try and post a circuit diagram later

Dave

wellyboot
- 24th March 2009, 08:37
attached a picture of display, and a circuit diagram

wellyboot
- 24th March 2009, 22:37
oppps its too late to edit last post,

The circuit appears to show all the columns in the matrix are connected directly to the top row, this is an error,


have attached a revised circuit.

note: that i have used the standard diode symbol instead of the LED symbol just to make it easier to draw, as i used the 'paint' program to do it!

earltyso
- 24th March 2009, 22:46
nice work!

I had lots of problems shifting through my rows when I built an ascii lookup table.

I have not tried shifting through colums, now I am motivated again to bust out the 8x8 matrices I have lying aroud my electronics cuboard again.

wellyboot
- 26th March 2009, 23:45
Hi

Have added a LM35 Temperature sensor to the above circuit, connecting the output from the sensor to AN0 (pin2) of the PIC.

Now i have a scrolling temperature reading in degrees C on my display.

I have stored the data for the numerical characters in the internal eeprom, as i didnt have enough memory to store it in a varible array .

The characters for the numbers look a bit naff, but can easlierly be altered to look better.

Again im no expert, and only put this together this evening! but seems to work quite well.

hoggefx
- 29th March 2009, 10:41
Nice !

Thanks.

wellyboot
- 29th March 2009, 17:15
Hi again, Thanks for your replys, have made a couple of alterations

1st) I noticed when the digits 1st came onto the display on the right hand side column, the left hand side column some of the LEDs lit very dimmly when they should have been off.
I have modified the 'LOOP' section of code as follows to fix this problem and speed up the scrolling a bit too.

LOOP:
FOR scroll = 0 TO 35
FOR scan = 0 TO 15
PORTC = 1
FOR counter = 0 TO 7
PORTB = leddata [counter]
PAUSEUS 1500
PORTB = 0
PORTC = PORTC * 2
NEXT
NEXT
FOR counter = 0 TO 34
leddata [counter] = leddata [counter+1]
NEXT
NEXT
GOTO START
END


2) I have improved the look of the characters in the eeprom locations as follows:

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

3) I have noticed that if the LM35 is too close to the PIC IC the output is higher than normal resulting in a higher temperature being displayed, the PIC IC is cold so i have no idea why this is happening. I have soldered my LM35 onto 3 wires about 4cm's from the board which seems to have corrected the problem.

Hope this covers all the bugs!

wellyboot
- 23rd May 2009, 14:46
Hello

Have posted a working example of the above project on youtube:

http://www.youtube.com/watch?v=3VkWxiaCJWI

valdirdf
- 31st May 2009, 02:37
please, it sends the project of the clock and code source.:)


Hi again, Thanks for your replys, have made a couple of alterations

1st) I noticed when the digits 1st came onto the display on the right hand side column, the left hand side column some of the LEDs lit very dimmly when they should have been off.
I have modified the 'LOOP' section of code as follows to fix this problem and speed up the scrolling a bit too.

LOOP:
FOR scroll = 0 TO 35
FOR scan = 0 TO 15
PORTC = 1
FOR counter = 0 TO 7
PORTB = leddata [counter]
PAUSEUS 1500
PORTB = 0
PORTC = PORTC * 2
NEXT
NEXT
FOR counter = 0 TO 34
leddata [counter] = leddata [counter+1]
NEXT
NEXT
GOTO START
END


2) I have improved the look of the characters in the eeprom locations as follows:

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

3) I have noticed that if the LM35 is too close to the PIC IC the output is higher than normal resulting in a higher temperature being displayed, the PIC IC is cold so i have no idea why this is happening. I have soldered my LM35 onto 3 wires about 4cm's from the board which seems to have corrected the problem.

Hope this covers all the bugs!

GoldStar
- 5th June 2009, 07:18
Wow, that is really cool. I was expecting the source code to be at least a full screen full. Good work, I have this one added to favorites

t_mask17
- 11th December 2009, 18:10
Ma'am/ Sir

I would like to see your circuit diagram or schematic diagram for your temperature sensor also the source code for this item...

I'm a newbie in PIC and I would like to use PIC16f877a

Hope you could help me pls

wellyboot
- 13th December 2009, 15:56
Hi


Take a look at the 3rd post for circuit diagram (without LM35 sensor)
take a look at 5th post for code, and 7th post for modification to code

also this line (27th) in the code:

ADCON1 = %10000101 'AN0 ANALOG I/P + right justify result

needs changing to:

ADCON1 = %10001110 'AN0 ANALOG I/P + right justify result

this will set AN0 only to analog and the rest of portA to digital, this where you connect a LM35 temperature sensor output.

I believe this code should work with a 16F877 aswel but not 100% sure

baco1978
- 16th January 2010, 03:32
Hi,

i really like the idea of a scrolling temperature display.

could somebody post the hexfile?
in the lite version the 16F872 isn't supported :(

thanks

krish69
- 2nd April 2010, 15:37
dear wellyboot,

thanks a lot for share this application with the members..
can u modify it to a scrolling clock or both scrolling clock+thermometer??
i really need one to built...
waiting for ur reply

thanks
krish69:rolleyes:

Ioannis
- 2nd April 2010, 16:21
Now that i see the circuit again, why not use the 2803 instead of two 2004?

Ioannis

wellyboot
- 2nd April 2010, 19:55
hi

the only reason i used 2004's is due to me having loads of these floating around, when i bought them i wasnt aware of a 8 channel device.

cant see any reason you cant use a 2803

krish69
- 4th April 2010, 07:47
dear wellyboot,

thanks a lot for share this application with the members..
can u modify it to a scrolling clock or both scrolling clock+thermometer??
i really need one to built...
waiting for ur reply

thanks
krish69:rolleyes:


dear wellyboot..

waiting for ur answer for my request..

thanks

wellyboot
- 13th April 2010, 15:37
krish69

I would connect to a DS1307 Real time clock IC, add a couple of buttons then you could modifiy the code to read/write to the DS1307 and convert the digits to be displayed.

search around for examples of how to read/write to the DS1307, then the rest should be quite easy.

krish69
- 5th May 2010, 12:42
Dera sir,
first of all thanks for ur reply..
i'm just a beginner for these field...
i did all hardware for ur scrool temp display..but when i try to convert
(by using MPLAB ide 7.5) ur codes to hex file,i give the path to saved it in C:\out put directory in my pc..

these errors came..what mistake did i do..?pls help
thanks
--------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F872 "matrix.asm" /l"matrix.lst" /e"matrix.err"
Error[108] C:\OUTPUT\MATRIX.ASM 1 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 2 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 3 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 4 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 5 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 6 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 7 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 8 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 9 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 10 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 11 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 12 : Illegal character (')
Warning[207] C:\OUTPUT\MATRIX.ASM 13 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 13 : Illegal character (0)
Warning[207] C:\OUTPUT\MATRIX.ASM 14 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 14 : Illegal character (5)
Warning[207] C:\OUTPUT\MATRIX.ASM 15 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 15 : Illegal character (1)
Warning[207] C:\OUTPUT\MATRIX.ASM 16 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 16 : Illegal character (1)
Warning[207] C:\OUTPUT\MATRIX.ASM 17 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 17 : Illegal character (2)
Warning[207] C:\OUTPUT\MATRIX.ASM 18 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 18 : Illegal character (2)
Warning[207] C:\OUTPUT\MATRIX.ASM 19 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 19 : Illegal character (3)
Warning[207] C:\OUTPUT\MATRIX.ASM 20 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 20 : Illegal character (3)
Warning[207] C:\OUTPUT\MATRIX.ASM 21 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 21 : Illegal character (4)
Warning[207] C:\OUTPUT\MATRIX.ASM 22 : Found label after column 1. (eeprom)
Error[108] C:\OUTPUT\MATRIX.ASM 22 : Illegal character (4)
Error[122] C:\OUTPUT\MATRIX.ASM 24 : Illegal opcode (ADC_BITS)
Error[122] C:\OUTPUT\MATRIX.ASM 25 : Illegal opcode (ADC_CLOCK)
Error[122] C:\OUTPUT\MATRIX.ASM 26 : Illegal opcode (ADC_SAMPLEUS)
Error[128] C:\OUTPUT\MATRIX.ASM 27 : Missing argument(s)
Error[128] C:\OUTPUT\MATRIX.ASM 28 : Missing argument(s)
Error[128] C:\OUTPUT\MATRIX.ASM 30 : Missing argument(s)
Error[128] C:\OUTPUT\MATRIX.ASM 31 : Missing argument(s)
Error[128] C:\OUTPUT\MATRIX.ASM 32 : Missing argument(s)
Warning[207] C:\OUTPUT\MATRIX.ASM 33 : Found label after column 1. (counter)
Error[122] C:\OUTPUT\MATRIX.ASM 33 : Illegal opcode (var)
Warning[207] C:\OUTPUT\MATRIX.ASM 34 : Found label after column 1. (scan)
Error[122] C:\OUTPUT\MATRIX.ASM 34 : Illegal opcode (var)
Warning[207] C:\OUTPUT\MATRIX.ASM 35 : Found label after column 1. (scroll)
Error[122] C:\OUTPUT\MATRIX.ASM 35 : Illegal opcode (var)
Warning[207] C:\OUTPUT\MATRIX.ASM 36 : Found label after column 1. (leddata)
Error[122] C:\OUTPUT\MATRIX.ASM 36 : Illegal opcode (var)
Warning[207] C:\OUTPUT\MATRIX.ASM 37 : Found label after column 1. (temp)
Error[122] C:\OUTPUT\MATRIX.ASM 37 : Illegal opcode (var)
Warning[207] C:\OUTPUT\MATRIX.ASM 38 : Found label after column 1. (tempA)
Error[122] C:\OUTPUT\MATRIX.ASM 38 : Illegal opcode (var)
Warning[207] C:\OUTPUT\MATRIX.ASM 39 : Found label after column 1. (tempB)
Error[122] C:\OUTPUT\MATRIX.ASM 39 : Illegal opcode (var)
Warning[207] C:\OUTPUT\MATRIX.ASM 40 : Found label after column 1. (tempC)
Error[122] C:\OUTPUT\MATRIX.ASM 40 : Illegal opcode (var)
Warning[207] C:\OUTPUT\MATRIX.ASM 42 : Found label after column 1. (CLEAR)
Error[108] C:\OUTPUT\MATRIX.ASM 42 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 44 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 45 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 46 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 47 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 48 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 49 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 50 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 51 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 52 : Illegal character (')
Error[108] C:\OUTPUT\MATRIX.ASM 53 : Illegal character (')
Warning[207] C:\OUTPUT\MATRIX.ASM 55 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 55 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 56 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 56 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 58 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 58 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 59 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 59 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 60 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 60 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 61 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 61 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 62 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 62 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 63 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 63 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 65 : Found label after column 1. (ADCIN)
Error[108] C:\OUTPUT\MATRIX.ASM 65 : Illegal character (0)
Warning[207] C:\OUTPUT\MATRIX.ASM 66 : Found label after column 1. (temp)
Error[113] C:\OUTPUT\MATRIX.ASM 66 : Symbol not previously defined (temp)
Warning[209] C:\OUTPUT\MATRIX.ASM 66 : Missing quote
Error[124] C:\OUTPUT\MATRIX.ASM 66 : Illegal argument (expected single character)
Error[112] C:\OUTPUT\MATRIX.ASM 66 : Missing operator
Warning[207] C:\OUTPUT\MATRIX.ASM 67 : Found label after column 1. (temp)
Warning[207] C:\OUTPUT\MATRIX.ASM 69 : Found label after column 1. (tempA)
Error[113] C:\OUTPUT\MATRIX.ASM 69 : Symbol not previously defined (DIG)
Error[112] C:\OUTPUT\MATRIX.ASM 69 : Missing operator
Warning[207] C:\OUTPUT\MATRIX.ASM 70 : Found label after column 1. (tempB)
Error[113] C:\OUTPUT\MATRIX.ASM 70 : Symbol not previously defined (DIG)
Error[112] C:\OUTPUT\MATRIX.ASM 70 : Missing operator
Warning[207] C:\OUTPUT\MATRIX.ASM 71 : Found label after column 1. (tempC)
Error[113] C:\OUTPUT\MATRIX.ASM 71 : Symbol not previously defined (DIG)
Error[112] C:\OUTPUT\MATRIX.ASM 71 : Missing operator
Error[108] C:\OUTPUT\MATRIX.ASM 73 : Illegal character (=)
Warning[207] C:\OUTPUT\MATRIX.ASM 76 : Found label after column 1. (FOR)
Error[122] C:\OUTPUT\MATRIX.ASM 76 : Illegal opcode (counter)
Warning[207] C:\OUTPUT\MATRIX.ASM 77 : Found label after column 1. (READ)
Error[122] C:\OUTPUT\MATRIX.ASM 77 : Illegal opcode (tempA)
Warning[207] C:\OUTPUT\MATRIX.ASM 78 : Found label after column 1. (NEXT)
Error[122] C:\OUTPUT\MATRIX.ASM 78 : Illegal opcode (counter)
Warning[207] C:\OUTPUT\MATRIX.ASM 80 : Found label after column 1. (FOR)
Error[122] C:\OUTPUT\MATRIX.ASM 80 : Illegal opcode (counter)
Warning[207] C:\OUTPUT\MATRIX.ASM 81 : Found label after column 1. (READ)
Error[122] C:\OUTPUT\MATRIX.ASM 81 : Illegal opcode (tempB)
Warning[207] C:\OUTPUT\MATRIX.ASM 82 : Found label after column 1. (NEXT)
Warning[207] C:\OUTPUT\MATRIX.ASM 83 : Found label after column 1. (FOR)
Error[122] C:\OUTPUT\MATRIX.ASM 83 : Illegal opcode (counter)
Warning[207] C:\OUTPUT\MATRIX.ASM 84 : Found label after column 1. (READ)
Error[122] C:\OUTPUT\MATRIX.ASM 84 : Illegal opcode (tempC)
Warning[207] C:\OUTPUT\MATRIX.ASM 85 : Found label after column 1. (NEXT)
Warning[207] C:\OUTPUT\MATRIX.ASM 91 : Found label after column 1. (FOR)
Error[122] C:\OUTPUT\MATRIX.ASM 91 : Illegal opcode (scroll)
Warning[207] C:\OUTPUT\MATRIX.ASM 92 : Found label after column 1. (FOR)
Error[122] C:\OUTPUT\MATRIX.ASM 92 : Illegal opcode (scan)
Warning[207] C:\OUTPUT\MATRIX.ASM 93 : Found label after column 1. (PORTC)
Warning[207] C:\OUTPUT\MATRIX.ASM 94 : Found label after column 1. (FOR)
Error[122] C:\OUTPUT\MATRIX.ASM 94 : Illegal opcode (counter)
Warning[207] C:\OUTPUT\MATRIX.ASM 95 : Found label after column 1. (PORTB)
Error[113] C:\OUTPUT\MATRIX.ASM 95 : Symbol not previously defined (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 95 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 96 : Found label after column 1. (PAUSE)
Error[108] C:\OUTPUT\MATRIX.ASM 96 : Illegal character (1)
Warning[207] C:\OUTPUT\MATRIX.ASM 97 : Found label after column 1. (PORTC)
Warning[207] C:\OUTPUT\MATRIX.ASM 98 : Found label after column 1. (NEXT)
Warning[207] C:\OUTPUT\MATRIX.ASM 99 : Found label after column 1. (NEXT)
Warning[207] C:\OUTPUT\MATRIX.ASM 100 : Found label after column 1. (FOR)
Error[122] C:\OUTPUT\MATRIX.ASM 100 : Illegal opcode (counter)
Warning[207] C:\OUTPUT\MATRIX.ASM 101 : Found label after column 1. (leddata)
Error[108] C:\OUTPUT\MATRIX.ASM 101 : Illegal character ([)
Warning[207] C:\OUTPUT\MATRIX.ASM 102 : Found label after column 1. (NEXT)
Warning[207] C:\OUTPUT\MATRIX.ASM 103 : Found label after column 1. (NEXT)
Warning[205] C:\OUTPUT\MATRIX.ASM 105 : Found directive in column 1. (END)
Skipping link step. Not all sources built successfully.
BUILD FAILED: Thu may 3,10.20am

krish69
- 6th May 2010, 08:15
Dear
wellyboot

i think the program me is not compatible to mplab..

can u give the programme language name n a compiler to convert ur codes to HEX format..?

if u post hex file il highly appreciate.

i buld all the hardware but stuck in software part that unable to finish..

hop u can understand my situation

thanks
krish69

wellyboot
- 6th May 2010, 21:19
Im using PicBasic Pro + MPLAB IDE

krish69
- 7th May 2010, 01:24
Dear wellyb00t

thank u for the fast reply..

il try to convert codes using the same using the soft you mentioned and will inform if i encountered.

thanks again sir,

krish69

wellyboot
- 23rd January 2011, 09:20
Hi,

i really like the idea of a scrolling temperature display.

could somebody post the hexfile?
in the lite version the 16F872 isn't supported

thanks



Have uploaded a updated version which has a indication arrow displaying an increase or decrease in temperature.

HEX file can be found here:

http://www.filefactory.com/f/df8a94fb9e2fab81/

Thanks

xxxxxx
- 6th February 2011, 12:51
Have uploaded a updated version which has a indication arrow displaying an increase or decrease in temperature.

HEX file can be found here:

http://www.filefactory.com/f/df8a94fb9e2fab81/

Thanks

now i quote this to get your help, i already ask you on your youtube chanel, about how to organize loop to display static letter or number, without scroll feature on 8x8 dot matrix could you please give me a some hint how to do that, i tried to rorganize this loop from your example but not geting enything on matrix.... thx in advance

xxxxxx
- 6th February 2011, 14:22
hello again I menaged to display letter M on 5x7 dot matrix with this changed code is this a good solution

' SIMPLE 8X8 LED MATRIX SCROLLING EXAMPLE
' 16F872 External 4MHz Xtal Osc
' LED Matrix columns are conected to PORTC pin rc0 via ULN2004AN and CD4017 to 0v.
' RC1 reset for 4017
' LED Matrix rows conected to PORTB via 100 ohm resistors (Resistor value dependant on LEDs used)
' RB0 - top row
' MCLR (pin1) connected via 4K7 to +5v supply.
'
' today
'************************************************* **************************************
Device 16F877A
TRISB = %00000000
TRISC = %00000000
PORTB=0
PORTC=0
kolona var Byte
brojac var Byte
scan var Byte
scroll var Byte
leddata VAR Byte[5]

START:

Clear

leddata[0] = $FF 'start of 'm'
leddata[1] = $40
leddata[2] =$20
leddata[3] =$40
leddata[4] = $FF
LOOP:

'For scroll = 0 To 34

For scan = 0 To 12 ' scan speed
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next

GoTo START
End





any idea how to change letters????

xxxxxx
- 6th February 2011, 21:22
now i manage to change code to show leter M and then some simbol with duration of 500ms,
Device 16F877A
Xtal 8
TRISB = %00000000
TRISC = %00000000
PORTB=0
PORTC=0
kolona var Byte
brojac var Byte
scan var Byte
scroll var Byte
leddata VAR Byte[10]

brojac=0
START:
Clear
leddata[0] = $FF 'start of 'm'
leddata[1] = $40
leddata[2] =$20
leddata[3] =$40
leddata[4] = $FF
leddata[5] = $0f 'start of 'z'
leddata[6] = $f0
leddata[7] =$0f
leddata[8] =$f0
leddata[9] = $0F
LOOP:

For scroll = 0 To 1

PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For scan = 0 To 500
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayMS 1
PORTB=0
Next
Next
For brojac = 0 To 4
leddata[brojac]=leddata[brojac+5]
Next
Next
GoTo START
End

is this good solution....i am trying to build up my programing skills :D, i was playing with PLC's for 2 year so i forgot even basic stuff...evantally i am going to build BABY ON BOARD with 4 5x7 dot matrix and cascade 4017, srolling static going up going down...so i need help :D

Archangel
- 7th February 2011, 01:37
I have seen those yellow B.O.B. signs for years and have always questioned their logic. It seems to me if I am maniacal enough to kill you in traffic, is not taking out your offspring a bonus? A scrolling B.O.B. sign might just be the trigger . . . Ugh, not for ME but THEY are out there.

xxxxxx
- 7th February 2011, 15:33
:D well i hope i will triger a nicer behavior in trafic..... or i could scroll ...eat my dust... :D that would be a good treiger :D!!!

wellyboot
- 7th February 2011, 22:41
hello this may help, I have eeprom values for displaying characters this should fit on pic's with larger eeprom storage such as a 16f877
the code snippet reads the eeprom characters into the leddata varible and should display them scrolling.....well hopefully i havnt tested myself!



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
eeprom 50,[%00000100,%00000110,%01111111,%00000110,%00000100] 'Up Arrow
eeprom 55,[%00010000,%00110000,%01111111,%00110000,%00010000] 'Dn Arrow
eeprom 60,[%01111110,%00010001,%00010001,%00010001,%01111110] 'A
eeprom 65,[%01111111,%01001001,%01001001,%01001001,%00110110] 'B
eeprom 70,[%00111110,%01000001,%01000001,%01000001,%00100010] 'C
eeprom 75,[%01111111,%01000001,%01000001,%00100010,%00011100] 'D
eeprom 80,[%01111111,%01001001,%01001001,%01001001,%01000001] 'E
eeprom 85,[%01111111,%00001001,%00001001,%00001001,%00000001] 'F
eeprom 90,[%00111110,%01000001,%01001001,%01001001,%01111010] 'G
eeprom 95,[%01111111,%00001000,%00001000,%00001000,%01111111] 'H
eeprom 100,[%00000000,%01000001,%01111111,%01000001,%00000000] 'I
eeprom 105,[%00100000,%01000000,%01000001,%00111111,%00000001] 'J
eeprom 110,[%01111111,%00001000,%00010100,%00100010,%01000001] 'K
eeprom 115,[%01111111,%01000000,%01000000,%01000000,%01000000] 'L
eeprom 120,[%01111111,%00000010,%00000110,%00000010,%01111111] 'M
eeprom 125,[%01111111,%00000100,%00001000,%00010000,%01111111] 'N
eeprom 130,[%00111110,%01000001,%01000001,%01000001,%00111110] 'O
eeprom 135,[%01111111,%00001001,%00001001,%00001001,%00000110] 'P
eeprom 140,[%00111110,%01000001,%01010001,%00100001,%01011110] 'Q
eeprom 145,[%01111111,%00001001,%00011001,%00101001,%01000110] 'R
eeprom 150,[%01000110,%01001001,%01001001,%01001001,%00110001] 'S
eeprom 155,[%00000001,%00000001,%01111111,%00000001,%00000001] 'T
eeprom 160,[%00111111,%01000000,%01000000,%01000000,%00111111] 'U
eeprom 165,[%00011111,%00100000,%01000000,%00100000,%00011111] 'V
eeprom 170,[%00111111,%01000000,%00110000,%01000000,%00111111] 'W
eeprom 175,[%01100011,%00010100,%00001000,%00010100,%01100011] 'X
eeprom 180,[%00000111,%00001000,%01110000,%00001000,%00000111] 'Y
eeprom 185,[%01100001,%01010001,%01001001,%01000101,%01000011] 'Z
eeprom 190,[%00100000,%00010000,%00001000,%00000100,%00000010] '/

leddata var byte[80]


START:
CLEAR
FOR counter = 0 TO 4
READ counter+65, leddata [counter+5] 'B
READ counter+60, leddata [counter+11] 'A
READ counter+65, leddata [counter+17] 'B
READ counter+189, leddata [counter+23] 'Y

READ counter+130, leddata [counter+32] 'O
READ counter+125, leddata [counter+38] 'N

READ counter+65, leddata [counter+47] 'B
READ counter+130, leddata [counter+53] 'O
READ counter+60, leddata [counter+59] 'A
READ counter+145, leddata [counter+65] 'R
READ counter+75, leddata [counter+71] 'D
NEXT

LOOP:

FOR scroll = 0 TO 77
FOR scan = 0 TO 15
PORTC = 1
FOR counter = 0 TO 7
PORTB = leddata [counter]
PAUSEUS 1500
PORTB = 0 'This helps prevent ghosting
PORTC = PORTC * 2
NEXT
NEXT
FOR counter = 0 TO 78
leddata [counter] = leddata [counter+1] ' *** SHIFTS DATA IN leddata ARRAY DOWN.***
NEXT
NEXT
GOTO START
End


you will have to modify the loop section to suit your 4017 setup

xxxxxx
- 7th February 2011, 23:00
of course this is helpful here is the code that i changed, i know there is a beter way to feed variable but this is for testing and is the siplest way...thx for helping and insiration :D

http://www.youtube.com/watch?v=aMkCDUU3dpc

and link for video.



'************************************************* ***************
' SIMPLE 14X8 LED MATRIX SCROLLING EXAMPLE
' LED Matrix columns are conected to PORTC pin rc0 via ULN2003 and CD4017.
' RC1 reset for 4017
' LED Matrix rows conected to PORTB via 100 ohm resistors (Resistor value dependant on LEDs used)
' RB0 - top row
' MCLR (pin1) connected via 4K7 to +5v supply.
'
' today
'************************************************* **************************************
Device 16F877A
Xtal 8
TRISB = %00000000
TRISC = %00000000
PORTB=0
PORTC=0
kolona var Byte
brojac var Byte
scan var Byte
scroll var Byte
leddata VAR Byte[47]
START:
Clear

leddata[0] = $FF
leddata[1] = $91
leddata[2] =$91
leddata[3] =$90
leddata[4] = $01
leddata[5] = $01
leddata[6] = $ff
leddata[7] =$01
leddata[8] =$01
leddata[9] = $46
leddata[10] = $89
leddata[11] = $99
leddata[12] =$b1
leddata[13] =$62
leddata[14] = $00 'start smjalija
leddata[15] = $00
leddata[16] = $00
leddata[17] = $7e
leddata[18] =$81
leddata[19] =$95
leddata[20] = $a1
leddata[21] = $a1
leddata[22] = $95
leddata[23] =$81
leddata[24] =$7e
leddata[25] =$00
leddata[26] =$00
leddata[27] = $00
leddata[28] = $00


LOOP:
For scroll = 0 To 1 ' NUMBER OF LETERS or changes display TO SHOW

For scan = 0 To 185

PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 13
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 250
PORTB=0
Next
Next
For brojac = 0 To 14
leddata[brojac]=leddata[brojac+14]
Next
Next
GoSub scrolling
GoTo START
End
scrolling:
leddata[0] = $00
leddata[1] = $00
leddata[2] = $00
leddata[3] = $00
leddata[4] = $00
leddata[5] = $00
leddata[6] = $00
leddata[7] = $00
leddata[8] = $00
leddata[9] = $00
leddata[10] = $00
leddata[11] = $00
leddata[12] = $00
leddata[13] = $00
leddata[14] = $00
leddata[15] = $00
leddata[16] = $00
leddata[17] = $00
leddata[18] = $FF 'start of 'E'
leddata[19] = $91
leddata[20] =$91
leddata[21] =$81
leddata[22] = $81
leddata[23] = $00
leddata[24] = $01 'start of 'T'
leddata[25] = $01
leddata[26] =$ff
leddata[27] =$01
leddata[28] = $01
leddata[29] = $46 'start of 'S'
leddata[30] = $89
leddata[31] =$99
leddata[32] =$b1
leddata[33] = $62
leddata[34] = $00 'start of '!'
leddata[35] = $00
leddata[36] =$df
leddata[37] =$00
leddata[38] =$00
For scroll = 0 To 38 ' NUMBER OF LETERS TO SHOW


For scan = 0 To 25
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 14
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 300
PORTB=0
Next
Next
For brojac = 0 To 37
leddata[brojac]=leddata[brojac+1]
Next
Next
Return

Archangel
- 9th February 2011, 05:11
:D well i hope i will trigger a nicer behavior in trafic..... or i could scroll ...eat my dust... :D that would be a good trigger :D!!!
Owing to where you live, your city has about 60 square miles more space and 3.5 million less people, which all somewhat resemble one another, you will very likely not encounter a problem there. Not so lucky here.
HERE you see drivers with signage, they are usually the worst drivers on the road, I got behind one last month with Oregon plates, Obama and Save The Whales stickers waiting to turn left on a green light when the opposing traffic was facing a red light, and she sat and waited while they turned right in front of her. In LA LA Land eat my dust might just get a body shot. Sadly, It happens here, not a lot, but it happens.
Good luck with your project, it looks like you have gotten a handle on it, I was thinking, if you only want one message, why include the entire alphabet? It would seem you only need a few letters (7), or are you intending to make an ever changing string ?
EDIT: the above (last paragraph) is in reference to your earlier code, actually wellyboot's code or for about $20 you can get a license plate frame with this feature built in.

xxxxxx
- 10th February 2011, 16:38
I was thinking, if you only want one message, why include the entire alphabet?

well just for fun and fere is first result :D

http://www.youtube.com/watch?v=AI7qg6oUg38

wellyboot
- 10th February 2011, 17:33
I was thinking, if you only want one message, why include the entire alphabet?

Above was just a cut and paste from a previous project that scrolled different infomation, I had stored the entire alphabet in the eeprom and just read the charactors i needed as required.

You could add a few buttons to the project so that different messages can be displayed.
'Baby on Board', 'Child on board', 'Back Off!!', 'Eat my Dirt' - hopefully you wont get shot at!

wellyboot
- 10th February 2011, 17:38
You could add a few buttons to the project so that different messages can be displayed.
'Baby on Board', 'Child on board', 'Back Off!!', 'Eat my Dirt' - hopefully you wont get shot at!

Just saw your video...looks good, any chance of seeing your code for reading the remote control?

krish69
- 10th February 2011, 18:21
of course this is helpful here is the code that i changed, i know there is a beter way to feed variable but this is for testing and is the siplest way...thx for helping and insiration :D

http://www.youtube.com/watch?v=aMkCDUU3dpc

and link for video.



'************************************************* ***************
' SIMPLE 14X8 LED MATRIX SCROLLING EXAMPLE
' LED Matrix columns are conected to PORTC pin rc0 via ULN2003 and CD4017.
' RC1 reset for 4017
' LED Matrix rows conected to PORTB via 100 ohm resistors (Resistor value dependant on LEDs used)
' RB0 - top row
' MCLR (pin1) connected via 4K7 to +5v supply.
'
' today
'************************************************* **************************************
Device 16F877A
Xtal 8
TRISB = %00000000
TRISC = %00000000
PORTB=0
PORTC=0
kolona var Byte
brojac var Byte
scan var Byte
scroll var Byte
leddata VAR Byte[47]
START:
Clear

leddata[0] = $FF
leddata[1] = $91
leddata[2] =$91
leddata[3] =$90
leddata[4] = $01
leddata[5] = $01
leddata[6] = $ff
leddata[7] =$01
leddata[8] =$01
leddata[9] = $46
leddata[10] = $89
leddata[11] = $99
leddata[12] =$b1
leddata[13] =$62
leddata[14] = $00 'start smjalija
leddata[15] = $00
leddata[16] = $00
leddata[17] = $7e
leddata[18] =$81
leddata[19] =$95
leddata[20] = $a1
leddata[21] = $a1
leddata[22] = $95
leddata[23] =$81
leddata[24] =$7e
leddata[25] =$00
leddata[26] =$00
leddata[27] = $00
leddata[28] = $00


LOOP:
For scroll = 0 To 1 ' NUMBER OF LETERS or changes display TO SHOW

For scan = 0 To 185

PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 13
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 250
PORTB=0
Next
Next
For brojac = 0 To 14
leddata[brojac]=leddata[brojac+14]
Next
Next
GoSub scrolling
GoTo START
End
scrolling:
leddata[0] = $00
leddata[1] = $00
leddata[2] = $00
leddata[3] = $00
leddata[4] = $00
leddata[5] = $00
leddata[6] = $00
leddata[7] = $00
leddata[8] = $00
leddata[9] = $00
leddata[10] = $00
leddata[11] = $00
leddata[12] = $00
leddata[13] = $00
leddata[14] = $00
leddata[15] = $00
leddata[16] = $00
leddata[17] = $00
leddata[18] = $FF 'start of 'E'
leddata[19] = $91
leddata[20] =$91
leddata[21] =$81
leddata[22] = $81
leddata[23] = $00
leddata[24] = $01 'start of 'T'
leddata[25] = $01
leddata[26] =$ff
leddata[27] =$01
leddata[28] = $01
leddata[29] = $46 'start of 'S'
leddata[30] = $89
leddata[31] =$99
leddata[32] =$b1
leddata[33] = $62
leddata[34] = $00 'start of '!'
leddata[35] = $00
leddata[36] =$df
leddata[37] =$00
leddata[38] =$00
For scroll = 0 To 38 ' NUMBER OF LETERS TO SHOW


For scan = 0 To 25
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 14
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 300
PORTB=0
Next
Next
For brojac = 0 To 37
leddata[brojac]=leddata[brojac+1]
Next
Next
Return




Dear sir,
can u put the schamatic for this project that u designed 14*8 matrix
thanks

xxxxxx
- 11th February 2011, 07:55
wel as for the reading of IR code i used a build in command from protonIde picbasic compiler, the code is only for testing puposes and not looking good :D as i yet didn't finished the implementing my idea, and here it is


'************************************************* ***************

' SIMPLE 15X8 LED MATRIX SCROLLING EXAMPLE
' 16F877A External 8MHz Xtal Osc
' LED Matrix columns are conected to PORTC pin rc0 via ULN2004AN and CD4017.
' RC1 reset for 4017
' LED Matrix rows conected to PORTB via 100 ohm resistors
' RB0 - top row
' Author: Muamer Halilovic
' www.mtskola.com
' today
'************************************************* **************************************
Device 16F877A
Xtal 8
TRISB = %00000000
TRISC = %10000000
TRISD = %00000000
PORTB=0
PORTC=0
PORTD=0
All_Digital = True

EWrite 0,[%00000100,%00000110,%01111111,%00000110,%00000100] 'Up Arrow
EWrite 5,[%00010000,%00110000,%01111111,%00110000,%00010000] 'Dn Arrow
EWrite 10,[%01111110,%00010001,%00010001,%00010001,%01111110] 'A
EWrite 15,[%01111111,%01001001,%01001001,%01001001,%00110110] 'B
EWrite 20,[%00111110,%01000001,%01000001,%01000001,%00100010] 'C
EWrite 25,[%01111111,%01000001,%01000001,%00100010,%00011100] 'D
EWrite 30,[%01111111,%01001001,%01001001,%01001001,%01000001] 'E
EWrite 35,[%01111111,%00001001,%00001001,%00001001,%00000001] 'F
EWrite 40,[%00111110,%01000001,%01001001,%01001001,%01111010] 'G
EWrite 45,[%01111111,%00001000,%00001000,%00001000,%01111111] 'H
EWrite 50,[%00000000,%01000001,%01111111,%01000001,%00000000] 'I
EWrite 55,[%00100000,%01000000,%01000001,%00111111,%00000001] 'J
EWrite 60,[%01111111,%00001000,%00010100,%00100010,%01000001] 'K
EWrite 65,[%01111111,%01000000,%01000000,%01000000,%01000000] 'L
EWrite 70,[%01111111,%00000010,%00000110,%00000010,%01111111] 'M
EWrite 75,[%01111111,%00000100,%00001000,%00010000,%01111111] 'N
EWrite 80,[%00111110,%01000001,%01000001,%01000001,%00111110] 'O
EWrite 85,[%01111111,%00001001,%00001001,%00001001,%00000110] 'P
EWrite 90,[%01111111,%00001001,%00011001,%00101001,%01000110] 'R
EWrite 95,[%01000110,%01001001,%01001001,%01001001,%00110001] 'S
EWrite 100,[%00000001,%00000001,%01111111,%00000001,%00000001] 'T
EWrite 105,[%00111111,%01000000,%01000000,%01000000,%00111111] 'U
EWrite 110,[%00011111,%00100000,%01000000,%00100000,%00011111] 'V


'_________________________________________________ _______________
'Deklaracija promjenjivih
'_________________________________________________ _______________
Dim kolona As Byte
Dim brojac As Byte
Dim k As Byte
Dim scan As Byte
Dim scroll As Byte
leddata var Byte[100]
Dim ir_ulaz As Word ' WORD variabla za zaprimanje podataka
Dim EEpromAdress As Byte 'eprom adresa za upis
Dim test As Word 'uporedjivach
Dim upisi As ir_ulaz.LowByte
Dim i As Byte
Dim sledeceslovo As Word
Dim prethodnoslovo As Word
Dim potvrdi As Word
Dim kraj As Word
Dim x As Byte
Dim j As Byte
Dim cnt As Byte

'_________________________________________________ _______________
'poetene vrijednosti
'_________________________________________________ _______________

EEpromAdress = 255
cnt=0
k=109
j=0
'_________________________________________________ _______________
'Inicijalizacija
'_________________________________________________ _______________
High PORTD.0
DelayMS 1300
Low PORTD.0
DelayMS 1300
'_________________________________________________ _______________
'pregledaj eeprom ako ima sta idi na main ako ne idi na pripremu
'_________________________________________________ _______________

provjera:

test.LowByte = ERead EEpromAdress 'iscitaj zapis iz eeproma sa adrese 255
If test.LowByte = $FF Then 'ako je FF pici dalje
GoSub eepromprogON
DelayMS 1000
EndIf
test.LowByte = ERead 255
If test.LowByte <> $FF Then
GoSub odaberporuku
DelayMS 1000
EndIf
'************************************************* ******************
Declare RC5In_Pin PORTC.7 'infrared sensor pin
'************************************************* *******************
main:
Clear
Low PORTD.0
j=0
leddata[0-13] = $00
For i = 0 To 4
k=115
leddata [i+14]=ERead k+i 'B
leddata [19]=$00
leddata [i+20]=ERead k+i+6 'B
leddata [25]=$00
leddata [i+26]=ERead k+i+12 'B
leddata [31]=$00
leddata [i+32]=ERead k+i+18 'B
Next


For scroll = 0 To 37 '


For scan = 0 To 50
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 14
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 150
PORTB=0
Next
Next
For brojac = 0 To 36
leddata[brojac]=leddata[brojac+1]
Next
Next
GoTo main

eepromprogON:
High PORTD.0

Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala

EWrite EEpromAdress , [ ir_ulaz.LowByte ]
sledeceslovo.LowByte = ERead EEpromAdress
Low PORTD.0
DelayMS 100
High PORTD.0
DelayMS 100
Low PORTD.0
DelayMS 100
High PORTD.0

Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala
EEpromAdress=EEpromAdress - 1
EWrite EEpromAdress , [ ir_ulaz.LowByte ]
prethodnoslovo.LowByte = ERead EEpromAdress
Low PORTD.0
DelayMS 100
High PORTD.0
DelayMS 100
Low PORTD.0
DelayMS 100
High PORTD.0

Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala
EEpromAdress=EEpromAdress - 1
EWrite EEpromAdress , [ ir_ulaz.LowByte ]
kraj.LowByte = ERead EEpromAdress
Low PORTD.0
DelayMS 100
High PORTD.0
DelayMS 100
Low PORTD.0
DelayMS 100
High PORTD.0

Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala
EEpromAdress=EEpromAdress -1
EWrite EEpromAdress , [ ir_ulaz.LowByte ]
potvrdi.LowByte = ERead EEpromAdress


For x=0 To 5
Toggle PORTD.0
DelayMS 100
x=x+1
Next
x=0
EEpromAdress=0
Return

odaberporuku:
High PORTD.0
While ir_ulaz.LowByte<>kraj.LowByte
Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala

If ir_ulaz.LowByte=sledeceslovo.LowByte Then

For i = 0 To 4
leddata [i]=ERead i+cnt '
Next
For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next
If cnt=115 Then
cnt=0
EndIf
cnt=cnt+5
' j=j+1
ElseIf ir_ulaz.LowByte=prethodnoslovo.LowByte Then

cnt=cnt-5
For i = 0 To 4
leddata [i]=ERead i+cnt '
Next
For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next
If cnt=0 Then
cnt=115
EndIf
' j=j+1

'zapamti slovo u eeprom na lokaciji 115 pa nadalje!

ElseIf ir_ulaz.LowByte=potvrdi.LowByte Then
k=k+6
For i = 0 To 4
leddata [i]=ERead i+cnt '
Next
For i = 0 To 4

EWrite (i+k),[leddata [i]] '
DelayMS 20
Next
Low PORTD.0
DelayMS 200
High PORTD.0


' j=j+1
'elseIf ir_ulaz.LowByte=kraj.lowbyte and j<>0 Then GoTo main
EndIf

Wend
'goto main
Return
End





as for the schematic i just used cd4017 datasheet section for cascading columns, the clock is portc.0 pin and the reset is portc.1 pin, as you can see i am working on a protoboard so i dont have a full schematic. This fun project is in development and probably wont be finished for long so i cant ofer a PCB design:(!!! thx again for help from everyone spacially wellyboot

krish69
- 11th February 2011, 08:51
to xxxxxx

thanks for the fast reply,it doesn't need full clear schematic just give what u modified/add to original one by 4017,i mean just how to connect,even hand draw on paint software is ok..
thanks n waiting for ur reply;;
krish

xxxxxx
- 11th February 2011, 15:58
it doesn't need full clear schematic just give what u modified/add to original one by 4017
krishhttp://www.electro-tech-online.com/attachments/electronic-projects-design-ideas-reviews/11881d1173530695-cascade-3-4017-counters-4017-expansion.jpg

well i use this schematic, clock is coming from portc.0, and reset is conected to portc.1, hope this would help

krish69
- 11th February 2011, 16:43
http://www.electro-tech-online.com/attachments/electronic-projects-design-ideas-reviews/11881d1173530695-cascade-3-4017-counters-4017-expansion.jpg
5159
well i use this schematic, clock is comming from portc.0, and reset is conected to portc.1, hope this would help
thank u so much...highly appreciate ur help n fast response..yes this clears lot questions..
tnx again
krish

Ioannis
- 11th February 2011, 18:16
If you choose to use a SIPO register (serial in-parallel output) then you will drop the AND gate in the cost of more I/O pins from the controller.

Like the 4094 chip.

Ioannis

xxxxxx
- 11th February 2011, 22:44
yes that is a great idea, going to google for samples of 4049!thx

xxxxxx
- 15th February 2011, 18:08
here is the final result, the message is Baby on Board on my native language (bosnian)

http://www.youtube.com/watch?v=TVS4ZxKpRVA

the code is made in ProtonIde compiler and is similar to PBP hope someone will use it


'************************************************* ***************

' SIMPLE 15X8 LED MATRIX SCROLLING EXAMPLE
' 16F877A External 8MHz Xtal Osc
' LED Matrix columns are conected to PORTC pin rc0 via ULN2004AN and CD4017.
' RC1 reset for 4017
' LED Matrix rows conected to PORTB via 100 ohm resistors
' RB0 - top row
' Author: Muamer Halilovic
' www.mtskola.com
' today
'************************************************* **************************************
Device 16F877A
Xtal 12
TRISB = %00000000
TRISC = %10000000
TRISD = %00000000
PORTB=0
PORTC=0
PORTD=0
All_Digital = True

EWrite 0,[%00000100,%00000110,%01111111,%00000110,%00000100] 'Up Arrow
EWrite 5,[%00010000,%00110000,%01111111,%00110000,%00010000] 'Dn Arrow
EWrite 10,[%01111110,%00010001,%00010001,%00010001,%01111110] 'A
EWrite 15,[%01111111,%01001001,%01001001,%01001001,%00110110] 'B
EWrite 20,[%00111110,%01000001,%01000001,%01000001,%00100010] 'C
EWrite 25,[%01111111,%01000001,%01000001,%00100010,%00011100] 'D
EWrite 30,[%01111111,%01001001,%01001001,%01001001,%01000001] 'E
EWrite 35,[%01111111,%00001001,%00001001,%00001001,%00000001] 'F
EWrite 40,[%00111110,%01000001,%01001001,%01001001,%01111010] 'G
EWrite 45,[%01111111,%00001000,%00001000,%00001000,%01111111] 'H
EWrite 50,[%00000000,%01000001,%01111111,%01000001,%00000000] 'I
EWrite 55,[%00100000,%01000000,%01000001,%00111111,%00000001] 'J
EWrite 60,[%01111111,%00001000,%00010100,%00100010,%01000001] 'K
EWrite 65,[%01111111,%01000000,%01000000,%01000000,%01000000] 'L
EWrite 70,[%01111111,%00000010,%00000110,%00000010,%01111111] 'M
EWrite 75,[%01111111,%00000100,%00001000,%00010000,%01111111] 'N
EWrite 80,[%00111110,%01000001,%01000001,%01000001,%00111110] 'O
EWrite 85,[%01111111,%00001001,%00001001,%00001001,%00000110] 'P
EWrite 90,[%01111111,%00001001,%00011001,%00101001,%01000110] 'R
EWrite 95,[%01000110,%01001001,%01001001,%01001001,%00110001] 'S
EWrite 100,[%00000001,%00000001,%01111111,%00000001,%00000001] 'T
EWrite 105,[%00111111,%01000000,%01000000,%01000000,%00111111] 'U
EWrite 110,[%00011111,%00100000,%01000000,%00100000,%00011111] 'V
EWrite 115,[$00,$00,$00,$00,$00] 'blank space
EWrite 185,[$00,$00,$00,$00,$00]
EWrite 190,[$00,$00,$00,$00,$00]
EWrite 195,[$00,$00,$00,$00,$00]
EWrite 200,[$00,$00,$00,$00,$00]
EWrite 205,[$00,$00,$00,$00,$00]
EWrite 210,[$00,$00,$00,$00,$00]
EWrite 215,[$00,$00,$00,$00,$00]
EWrite 220,[$00,$00,$00,$00,$00]
EWrite 225,[$00,$00,$00,$00,$00]
EWrite 230,[$00,$00,$00,$00,$00]
EWrite 235,[$00,$00,$00,$00,$00]
EWrite 240,[$00,$00,$00,$00,$00]
EWrite 245,[$00,$00,$00,$00,$00]



'_________________________________________________ _______________
'Deklaracija promjenjivih
'_________________________________________________ _______________
Dim kolona As Byte
Dim brojac As Byte
Dim k As Byte
Dim scan As Byte
Dim scroll As Byte
leddata var Byte[100]
Dim ir_ulaz As Word ' WORD variabla za zaprimanje podataka
Dim EEpromAdress As Byte 'eprom adresa za upis
Dim test As Word 'uporedjivach
Dim upisi As ir_ulaz.LowByte
Dim i As Byte
Dim sledeceslovo As Word
Dim prethodnoslovo As Word
Dim potvrdi As Word
Dim play As Word
Dim x As Byte
Dim j As Byte
Dim cnt As Byte
Dim a As Byte
Dim b As Byte
Dim c As Byte
Dim d As Byte

'_________________________________________________ _______________
'poetene vrijednosti
'_________________________________________________ _______________

EEpromAdress = 255
cnt=0
k=114

'_________________________________________________ _______________
'Inicijalizacija
'_________________________________________________ _______________
High PORTD.0
DelayMS 1300
Low PORTD.0
DelayMS 1300
'_________________________________________________ _______________
'pregledaj eeprom ako ima sta idi na main ako ne idi na pripremu
'_________________________________________________ _______________
'************************************************* ******************
Declare RC5In_Pin PORTC.7 'infrared sensor pin
'************************************************* *******************

provjera:

test.LowByte = ERead 255 'iscitaj zapis iz eeproma sa adrese 255
If test.LowByte = $FF Then 'ako je FF
GoSub eepromprogON 'idi u programiraj komande
DelayMS 500
EndIf
test.LowByte = ERead 120 ' iscitaj zapis iz eeproma sa adrese 120 (pocetak poruke)
If test.LowByte = $FF Then ' ako je 00
GoSub odaberporuku ' idi na odaberi poruku
DelayMS 500
EndIf

main:

Clear ' ocisti sve varijable
Low PORTD.0 ' usli smo u mod za prikaz poruke
a=14
k=120
j=0
leddata[0-13] = $00 ' varijabla ledadta od 0 do 13 je 00
For b = 0 To 11 ' moguci broj slova u poruci
For i = 0 To 4
c=i+a 'povecaj a=14-19; a=20-24; a=26-30 itd...
d=i+j+k 'povecaj j=120-124; a=126-130; a=131-135 itd...
leddata [c]= ERead d 'filuj ledadtu od 14 do max broja slova za prikaz iz eeproma pocevsi od 120 pa nadalje
DelayUS 20
Next
leddata [a+5]=ERead 119 'upisi prazanu kolonu izmedju slova
a=a+6
j=j+6
Next
For scroll = 0 To c ' skrolaj poruku c zadnji leddata

For scan = 0 To 35
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 14 'broj kolona
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 250
PORTB=0
Next

Next
For brojac = 0 To (c-1)
leddata[brojac]=leddata[brojac+1]' pomjeri za jedan
Next

Next
If PORTD.1=1 Then
GoSub odaberporuku
End If
GoTo main
End

eepromprogON: 'podprogram za odabir komadi za upravljanje
High PORTD.0

Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala

EWrite EEpromAdress , [ ir_ulaz.LowByte ]
sledeceslovo.LowByte = ERead EEpromAdress ' pridruzi varijabli sledece slovo komandu i upisi u eprom na zadnju lokaciju
For i = 0 To 4
leddata [i]=ERead i ' prikazi strelicu
Next
For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next
Low PORTD.0
DelayMS 100
High PORTD.0
DelayMS 100
Low PORTD.0
DelayMS 100
High PORTD.0
Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala
EEpromAdress=EEpromAdress - 1
EWrite EEpromAdress , [ ir_ulaz.LowByte ]
prethodnoslovo.LowByte = ERead EEpromAdress ' pridruzi varijabli sledece slovo komandu i upisi u eprom na zadnju lokaciju
For i = 0 To 4
leddata [i]=ERead i+5 ' prikazi strelicu
Next
For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next
Low PORTD.0
DelayMS 100
High PORTD.0
DelayMS 100
Low PORTD.0
DelayMS 100
High PORTD.0
Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala
EEpromAdress=EEpromAdress - 1
EWrite EEpromAdress , [ ir_ulaz.LowByte ]
play.LowByte = ERead EEpromAdress ' pridruzi varijabli play komandu i upisi u eprom na predzadnju lokaciju
leddata[0]=$FE 'play simbol
leddata[1]=$7C
leddata[2]=$38
leddata[3]=$10
leddata[4]=$00

For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next
Low PORTD.0
DelayMS 100
High PORTD.0
DelayMS 100
Low PORTD.0
DelayMS 100
High PORTD.0

Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala
EEpromAdress=EEpromAdress -1
EWrite EEpromAdress , [ ir_ulaz.LowByte ] ' pridruzi varijabli potvrfi komandu i upisi u eprom na predpredzadnju :D lokaciju
potvrdi.LowByte = ERead EEpromAdress

leddata[0]=$00
leddata[1]=$00
leddata[2]=$08
leddata[3]=$10
leddata[4]=$20
leddata[5]=$10
leddata[6]=$08
leddata[7]=$04
leddata[8]=$02
leddata[9]=$01
For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 9
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next
For x=0 To 5
Toggle PORTD.0
DelayMS 100
x=x+1
Next
x=0
EEpromAdress=0
Return 'vrati se u if petlju na pocetku



odaberporuku: ' podrpogram za odabir poruke za prikaz
High PORTD.0
sledeceslovo.LowByte = ERead 255
prethodnoslovo.LowByte = ERead 254
play.LowByte = ERead 253
potvrdi.LowByte = ERead 252
cnt=0
k=114
Low PORTD.1
Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala
While ir_ulaz.LowByte<>play.LowByte
Repeat
ir_ulaz.LowByte= RC5In ' Primanje signala sa TSOP1738
Until upisi<> 255' Trazi-cekaj dok ne naleti valjano zaglavlje signala
If ir_ulaz.LowByte=prethodnoslovo.LowByte Then
If cnt = 0 Then
cnt=5
EndIf
cnt=cnt-5
For i = 0 To 4
leddata [i]=ERead i+cnt '
Next
For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next

ElseIf ir_ulaz.LowByte=sledeceslovo.LowByte Then

cnt=cnt+5

For i = 0 To 4
leddata [i]=ERead i+cnt '
Next
For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 4
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next
If cnt = 119 Then
cnt=0
EndIf
ElseIf ir_ulaz.LowByte=potvrdi.LowByte Then 'upisi odabran0o slovo u narednu slobodnu eeprom lokaciju
k=k+6'krecemo od 120
For i = 0 To 4
leddata [i]=ERead i+cnt
DelayUS 10 '
Next

For i = 0 To 4

EWrite (i+k),[leddata [i]] '
DelayMS 20
Next

For scroll =0 To 1
For i = 0 To 4
leddata [i]=ERead i+cnt 'prikazi odabrano slovo
Next
leddata[5]=$00
leddata[6]=$00
leddata[7]=$08
leddata[8]=$10
leddata[9]=$20
leddata[10]=$10
leddata[11]=$08
leddata[12]=$04
leddata[13]=$02
leddata[14]=$01
For scan = 0 To 185
PORTC.1 = 1 'reseting 4017
PORTC.1 =0
For kolona = 0 To 14
PORTC.0 = 1 'clock 4017
PORTC.0 =0
PORTB = leddata[kolona]
DelayUS 500
PORTB=0
Next
Next
Next
EndIf

Wend
Low PORTD.0
Return ' vrati se odakle si i dosao

gabi68
- 17th February 2011, 12:51
Hi to all,

A newbie here. I try to compile the file from first post but I receive a constant error
ERROR Line 51: LOOP without a matching DO.
How can I avoid that?

Many thanks in advance
Gabi

P.S.
I know it is a old thread but maybe someone or OP will chime in and help me with that error

Ioannis
- 17th February 2011, 14:35
I suppose you are using PBP 2.60, right?

LOOP is a reserved word for 2.60. So use Loop1 or something.

Ioannis

gabi68
- 17th February 2011, 15:05
I suppose you are using PBP 2.60, right?

LOOP is a reserved word for 2.60. So use Loop1 or something.

Ioannis

Hi Ioannis,

Yes, sorry I forgot to tell that. Yessss it is working, meaning compile without errors. Now my problem it is in Proteus - Simulation it is not running on real time due the excessive CPU load?? Why?
Do I need to put some delays in the code?

Thank you in advance
Gabi

Ioannis
- 17th February 2011, 15:07
Sorry, I do not use Proteus.

I prefer the real stuff :)

Ioannis

gabi68
- 17th February 2011, 15:52
Still, Ioannis can you have a look on that code and give me your expert opinion

Rgds
Gabi

Ioannis
- 17th February 2011, 20:20
The code is simple and should run with no problems.

If you insist on simulation, I do not know much. I hear that Proteus is the Best, but still have a few flaws.

Did you try the code on real circuit?

Ioannis

gabi68
- 17th February 2011, 22:43
Hi Ioannis,

No, I do not have all the parts to try it. That was the reason for using Proteus. I saw a post from you regarding ULN 2083. If I decided to use that instead ULN 2004 what else should I need to modify (software and hardware)?

Regards
Gabi

wellyboot
- 18th February 2011, 11:20
regarding ULN 2083. If I decided to use that instead ULN 2004 what else should I need to modify (software and hardware)?

Regards
Gabi

ULN2803 is an 8 channel transistor array (18pin package), and the ULN2004 is a 7 channel transistor array (16pin package)

The software remains the same, with the hardware you can lower the component count, by replacing 2 ULN2004 with 1 ULN2803

gabi68
- 16th March 2011, 17:24
Hi,

After 1 month I finally make that running - simulating properly in Proteus. My problem was that ULN2803. I didn't know that chip invert signal's. After I put some hex inverters 7404 everything running properly.
My question is:
in real life (I will build the real circuit) I need that inverters or everything will run normal without that?

Many thanks
Gabi

Ioannis
- 17th March 2011, 08:34
Instead of inverters, why don't you invert he data that you output from the PIC?

Ioannis

Ioannis
- 17th March 2011, 08:34
Instead of inverters, why don't you invert the data that you output from the PIC?

Ioannis

gabi68
- 17th March 2011, 10:47
Hi Ioannis,

I try to do that but, I failed. Can you show my how? On the other hand the question it is still: do I need that inverters in a real circuit?

Thank you for your time
Gabi

Ioannis
- 17th March 2011, 11:58
If your load needs an 1 and you send a 0 then it is obvious that you need an inverter.

But as I said, instead of 1, send 0 in software.

For example,

var_a=%10101010

var_1=var_a XOR %11111111

The result in var_a will be the complement of the initial value.

Ioannis

wellyboot
- 29th September 2011, 14:43
Hi all,
This update now scrolls temperature in degrees C & F,
with indication arrow to show increase or decrease in temperature
and scrolls 'wellyb00t' at every few minutes.
Works with PBP 2.60C & MPLABS v8.63

wellyboot
- 29th September 2011, 15:23
See above post, this is the HEX file for it.

couldnt add a file with .hex extention so changed it to .txt
just remove .txt extention

normey
- 12th January 2012, 04:29
hello all..

i need your help. i want to build program even one word to display on dot matrix (7x5) with pic16f877a. i use c language. but when i compile it don't have any error. but it can't work on dot matrix after i load that program. anyone can help me.. i'm on stuck. hope you all can help me. here my program. i want use port a n port b.

#include <16f877a.h>


#use delay(clock=20000000)
#fuses hs,nowdt,nocpd,nolvp,noprotect

#byte porta=0x06
#byte portb=0x08
#bit clock=portd.6
#bit data=portd.7

unsigned int8 i,j,index1,n,
addr[11]={0xEA,0xEA,0x2A,0x2A,0x2A,0x2A,0xAA,0x82,0xFF,0xF F,0xFF},
cont[11];

void main()
{
set_tris_a(0x00);
set_tris_b(0x00);
while(1)
{
for(n=0;n<=99;n++)
{
data=1;
for(i=0;i<=5;i++)
{
clock=1;
portb=addr[i];
delay_ms(1);
clock=0;
data=0;
}
}

for(j=0;j<=7;j++)
{
cont[j]=addr[j];
}

for(j=0;j<=7;j++)
{
addr[j]=cont[j+1];
}
addr[10]=cont[0];

}
}


besides that i'm a new in programming. hope n hope anyone can help me.. thank you.

prasanna
- 5th March 2012, 15:42
Hi, Please let me know how to program this IC PIC16F872 as I am new to this area.
My email: [email protected]
Appreciate your help

krish69
- 6th March 2012, 01:25
Hi, Please let me know how to program this IC PIC16F872 as I am new to this area.
My email: [email protected]
Appreciate your help

u got lot to learn dear.u need a programmer n programming software to do this..
[r u from srilanka o uk?]

priya5
- 7th April 2012, 19:56
sir plz send me the code and ckt diagram of LED moving display using ATmega 16

Ioannis
- 7th April 2012, 20:10
This is a PIC controller forum. Not AVR.

Ioannis

cutemanikutti
- 9th July 2012, 06:55
Hi please any one would you able to help me to build the LED Matrix project? i have already designed it for 10x7 matrix. it's working nicely. but if i extend this to 20x7 then it s running and blinking fastly. i think the delay wil b a problem. now i want some guidelines from u. please it's urgent. help [email protected]. mail me the code in c

Ioannis
- 9th July 2012, 07:51
Sure, which compiler do you want me to make it?

Please, check the forum and what we do here. No C and sure no serving to the plate.

Ioannis

cutemanikutti
- 10th July 2012, 07:14
Thank you very much for ur quick reply,
Now i'm using MBlap HItech Compiler and Micro c for pic.

Please guide me. i already done this without shift register but when i try using shift register it's flickering please help me. it's urgent

Kalaiyarasi
- 3rd December 2012, 11:29
hai, i am doing project on PIC16F877A.I am executing the code in MPLAB.Can anyone help me to display the characters from A to Z in 8 X 8 LED using MPLAB code....

fratello
- 5th December 2012, 17:48
Take a look at this ...http://www.picbasic.co.uk/forum/content.php?r=449-Scrolling-thermometer

tashabahar
- 11th July 2013, 06:01
hello mr.fratello... can you help me? im very need your help.. i want to do font moving display... but the coding is complicated to me... can u teach me about the coding for font moving display...

tashabahar
- 11th July 2013, 06:03
im use pic 16f877a... please help me... anybody also can help me...