Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

DIY Moving Message Display

Status
Not open for further replies.
I just used PORTC to enable all decoders one by one.
 

My simplified 16 char PIC16 MMD circuits, more (but fix) messages

(re: My 16ch (16 x 5x7 leds) MMD project)

Meanwhile - on request - prepared some simplified versions of my PIC16 MMD (the source is here).

My own keyboard routines is also used if needed (but without any IT).

There are five variants (look at the attached pictures):

Amsg
auto rotating short fix msgs, no scrolling
selectable (re)start-msg and rotating time
quasi unlimited nr of msgs (max len: 1000)
140 (max 170) Hz refresh rate at 4 MHz clock


2msg
two static selectable msgs (max len: 1000)
scrolled or center aligned
SW brightness equalization, each matrix row get same "switched on" time
Appr 100 Hz refresh rate at 4 MHz clock


Mmsg
a lot of selectable msgs (by stepping), 2 power-on starting msgs
scrolled or center aligned
SW brightness equalization
quasi unlimited nr of msgs (max len: 1000)
Appr 100 Hz refresh rate at 4 MHz clock


Xmsg
6 selectable msgs (but 7 during power-on), (max len: 1000)
scrolled or center aligned
SW brightness equalization
easily expandable up to 15 msgs
Appr 100 Hz refresh rate at 4 MHz clock


XFmsg
the same as Xmsg but wait (no display, a led blinks) until release key(s)


All variants above are easily supplemented with a PC serial control (rx-tx).

The projects (full with source) are uploaded for all beloved Edaboard members (attached).

Merry Christmas and Happy New Year
zuisti
 

Attachments

  • PIC16-FixMsgs_noIT.rar
    264.9 KB · Views: 494
Led dot matrix scrolling message!!

Hi can anyone send me if ever you have already a code for PIC16F877A LED MATRIX BOARD 8X8 or 16X96.
Wherein I can just change the message with new one. Please HELP ME IT URGENT!! :(
This is my email boyjim32@yahoo.com
 

MMD and Alarm Clock by zuisti (a working Proteus hex project)

I work continuously on my PIC18 MMD project, it is still under development,
so only a working hex Proteus project (zipped) and a screenshot is attached.
I've not built it, working only in ISIS.Try it out please.

The DSN has two sheets (display and proc) and some masking 'widgets' on the first.



Some features:

- a cheap and small 28pin PIC (18F2620)
- two-line led matrix display (2 x 12 x 8x8)
- vertical and horizontal scroll (mixed too)
- right-left scroll (also mixed)
- scroll by char or by pixel
- start-stop scrolling, on-the-fly scroll speed setting
- on-the-fly selectable mode and messages
- single step by char or by line (also to begin/end)
- also double size chars
- HW spi to loading the hc595s
- IT controlled key-read with IT debouncing
- IT controlled matrix line (row) timing (protected also by the watchdog timer)
- two user modifiable message, stored in Eeprom, max 2x511 (in ISIS 2x127) chars
- plus max 98 fixed (known at the compiling time) msg (max 623 chars/msg, sum max 50k)
- one fixed msg with an inserted running clock (now: msg 2)
- settable DS1307 rtc (hw I2C) and sw alarm (via rtc IT) with sound (hour:min:sec only)
- simple msg editor also via onboard buttons (if no rs232)
- flashing cursor in msg editor and clock/alarm set
- 7seg displays (mode, msg nr, ascii code of a char ...)

----- and yet what I think in future :)

I know it is too much :)-), and the treatment is also not as simple,
(my goal was to test the basic routines), a realization is possible to simplify.

zuisti
 

Attachments

  • PIC18-MMD-2h.ZIP
    52.3 KB · Views: 384
Animation on the led matrix

I've used my PIC18 MMD circuit (see above) to realize this simple animation display.

Using the MS Paint program I've generated 11 pcs (no patience to make more :) simple
96x16 pixel BMP pictures for the 11 animation phase and I wrote a short program to display
them at 10 frame/second speed (the max speed may be 100 f/s at 4 MHz PIC clock).

A BMP is extracted to a 192 bytes long record, the program itself occupies only 232 bytes (!)
from the PIC's 64k flash so you can use max 340 frame pictures (ie a 34 seconds animation).

Attached a working Proteus hex project as a demo, maybe I use it for my new Multi Language
MMD project which is currently being prepared, like a power-on INTRO.

zuisti
 

Attachments

  • G-anim_h.zip
    28 KB · Views: 280

Dear zuisti how are you am proud of you i have started making this display in real life, my pic18f is now available so the journey is started
 

Animation on the led matrix (now full, with source and a little 'know-how')

On request here is the full PIC18 animation project (attached)
(see my prev. posts at this thread: #644 and #645)

- all the Proton source
- a readme file to explain how to make an own animation
- a simple batch file to automatize the process (not the drawing :)
- a simple console-only application to extract the BMP data bytes
(written by me, it's using in the batch)

Just as many of my request is that if someone makes a nice animation (using this), you let us know.

zuisti
PS.
@OBIALOR
Thanks and good luck!
 

Attachments

  • G-anim_full.rar
    35.3 KB · Views: 312
Re: cd4514 led scroll circuits

Hi,
I have implemented the same circuit with Atmega16 microcontroller. I am facing problem with preparation of 40 bits column values for all the 40 columns. E.g. if I want to scroll character 'A' from left to right, then how to update all the 40 columns at a time and feed the row.?
Any help would be useful.

Regards
Raj. S

---------- Post added at 12:36 ---------- Previous post was at 12:30 ----------

Saif,
Is this your own design?
PCB layout is not so good for understand the circuit, schematic diagram will be much better.

Some advices:
I don't have detail specification of 164 and 7445, 164 have to provide 5~20mA, depends on LED used. 7445 need 5 times the driving current.

Refresh rate should be >40Hz(very flicker) to 70Hz(very stable), that means switching each row in (1/40/7) 3.5ms to (1/70/7) 2ms, setup a timer to involve the scan() function.

A prelimary algorithm for your reference
Assuming Port1 connected to 7445 and port 2 to 164,
4 bytes (25 columns) used for display data for each row.
Code:
dispBuffer[row][col/8];
#define Sclock  P^0;
#define Sdata  P^1;

void scan(void) {
for (row=0; row<7 row++) {
  P1 = 0x00;  // turn off display
  for (i=0; i<4; i++)   // send 4 bytes of display data
    outOneByte(dispBuffer[row][i]);  // send data to 164
  P1 = 0x01<<row;  // enable one single row 
} }
  
void outOneByte(dispData) {
  Sclock = 0;  // serial clock low
  for (i=0; i<8; i++) {  //send 8 bits
    if ((dispData & 0x01)==1) Sdata = 1;
    else Sdata =0;
    Sclock =1;
    dispData >>=1;
} }

The above code fragments are by no means accurate, by only give a rough idea, you have to rewrite to fit your situation.

I will search some reference designs for you later.

Hi,
I am folliwng your code, but stuck in creating the dispBuffer[][] for all the 32 columns. Can you please tell me how to create this buffer for scrolling of character 'A' ?
 

Re: cd4514 led scroll circuits

-1-
... I am folliwng your code
-2-
...but stuck in creating the dispBuffer[][] for all the 32 columns...

Hi;

@1:
The code fragment (written - a long ago- by Epegic) contains two basic errors, so it will not work. Look for my red corrections:
Code:
dispBuffer[row][col/8];
#define Sclock  P^0;
#define Sdata  P^1;

void scan(void) {
for (row=0; row<7 row++) {
  P1 = 0x00;  // turn off display
  for (i=0; i<4; i++)   // send 4 bytes of display data
    outOneByte(dispBuffer[row][i]);  // send data to 164
  P1 = 0x01<<row;  // enable one single row 
  [COLOR="#FF0000"]Delayms(2); // this is a must if you want to see something :-)[/COLOR]
} }
  
void outOneByte(dispData) {
  Sclock = 0;  // serial clock low
  for (i=0; i<8; i++) {  //send 8 bits
    if ((dispData & 0x01)==1) Sdata = 1;
    else Sdata =0;
    Sclock = 1;
    [COLOR="#FF0000"]Sclock = 0;  // each bit requires a complete clock pulse !![/COLOR]
    dispData >>=1;
} }
@2:
There are a lot of methods to do this but in any case it depends on what kind of character bitmap table structure you are using. Many examples can be found on the net, but here in the forums too.

Good luck!
zuisti
 

Re: cd4514 led scroll circuits

Hi;

@1:
The code fragment (written - a long ago- by Epegic) contains two basic errors, so it will not work. Look for my red corrections:
Code:
dispBuffer[row][col/8];
#define Sclock  P^0;
#define Sdata  P^1;

void scan(void) {
for (row=0; row<7 row++) {
  P1 = 0x00;  // turn off display
  for (i=0; i<4; i++)   // send 4 bytes of display data
    outOneByte(dispBuffer[row][i]);  // send data to 164
  P1 = 0x01<<row;  // enable one single row 
  [COLOR="#FF0000"]Delayms(2); // this is a must if you want to see something :-)[/COLOR]
} }
  
void outOneByte(dispData) {
  Sclock = 0;  // serial clock low
  for (i=0; i<8; i++) {  //send 8 bits
    if ((dispData & 0x01)==1) Sdata = 1;
    else Sdata =0;
    Sclock = 1;
    [COLOR="#FF0000"]Sclock = 0;  // each bit requires a complete clock pulse !![/COLOR]
    dispData >>=1;
} }
@2:
There are a lot of methods to do this but in any case it depends on what kind of character bitmap table structure you are using. Many examples can be found on the net, but here in the forums too.

Good luck!
zuisti


Actually I am using this table with hex values of 5X8 matrix. And I want to scroll any one character in 32 columns from right to left. I need help in creating the "dispBuffer[row]" as sent in your code 4 times in a loop. Can you please help me.?

Code:
static const char PROGMEM  font5x8[] = {
0x00, 0x00, 0x00, 0x00, 0x00,// (spacja)
0x00, 0x00, 0x5F, 0x00, 0x00,// !
0x00, 0x07, 0x00, 0x07, 0x00,// "
0x14, 0x7F, 0x14, 0x7F, 0x14,// #
0x24, 0x2A, 0x7F, 0x2A, 0x12,// $
0x23, 0x13, 0x08, 0x64, 0x62,// %
0x36, 0x49, 0x55, 0x22, 0x50,// &
0x00, 0x05, 0x03, 0x00, 0x00,// '
0x00, 0x1C, 0x22, 0x41, 0x00,// (
0x00, 0x41, 0x22, 0x1C, 0x00,// )
0x08, 0x2A, 0x1C, 0x2A, 0x08,// *
0x08, 0x08, 0x3E, 0x08, 0x08,// +
0x00, 0x50, 0x30, 0x00, 0x00,// ,
0x08, 0x08, 0x08, 0x08, 0x08,// -
0x00, 0x30, 0x30, 0x00, 0x00,// .
0x20, 0x10, 0x08, 0x04, 0x02,// /
0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
0x00, 0x42, 0x7F, 0x40, 0x00,// 1
0x42, 0x61, 0x51, 0x49, 0x46,// 2
0x21, 0x41, 0x45, 0x4B, 0x31,// 3
0x18, 0x14, 0x12, 0x7F, 0x10,// 4
0x27, 0x45, 0x45, 0x45, 0x39,// 5
0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
0x01, 0x71, 0x09, 0x05, 0x03,// 7
0x36, 0x49, 0x49, 0x49, 0x36,// 8
0x06, 0x49, 0x49, 0x29, 0x1E,// 9
0x00, 0x36, 0x36, 0x00, 0x00,// :
0x00, 0x56, 0x36, 0x00, 0x00,// ;
0x00, 0x08, 0x14, 0x22, 0x41,// <
0x14, 0x14, 0x14, 0x14, 0x14,// =
0x41, 0x22, 0x14, 0x08, 0x00,// >
0x02, 0x01, 0x51, 0x09, 0x06,// ?
0x32, 0x49, 0x79, 0x41, 0x3E,// @
0x7E, 0x11, 0x11, 0x11, 0x7E,// A
0x7F, 0x49, 0x49, 0x49, 0x36,// B
0x3E, 0x41, 0x41, 0x41, 0x22,// C
0x7F, 0x41, 0x41, 0x22, 0x1C,// D
0x7F, 0x49, 0x49, 0x49, 0x41,// E
0x7F, 0x09, 0x09, 0x01, 0x01,// F
0x3E, 0x41, 0x41, 0x51, 0x32,// G
0x7F, 0x08, 0x08, 0x08, 0x7F,// H
0x00, 0x41, 0x7F, 0x41, 0x00,// I
0x20, 0x40, 0x41, 0x3F, 0x01,// J
0x7F, 0x08, 0x14, 0x22, 0x41,// K
0x7F, 0x40, 0x40, 0x40, 0x40,// L
0x7F, 0x02, 0x04, 0x02, 0x7F,// M
0x7F, 0x04, 0x08, 0x10, 0x7F,// N
0x3E, 0x41, 0x41, 0x41, 0x3E,// O
0x7F, 0x09, 0x09, 0x09, 0x06,// P
0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
0x7F, 0x09, 0x19, 0x29, 0x46,// R
0x46, 0x49, 0x49, 0x49, 0x31,// S
0x01, 0x01, 0x7F, 0x01, 0x01,// T
0x3F, 0x40, 0x40, 0x40, 0x3F,// U
0x1F, 0x20, 0x40, 0x20, 0x1F,// V
0x7F, 0x20, 0x18, 0x20, 0x7F,// W
0x63, 0x14, 0x08, 0x14, 0x63,// X
0x03, 0x04, 0x78, 0x04, 0x03,// Y
0x61, 0x51, 0x49, 0x45, 0x43,// Z
0x00, 0x00, 0x7F, 0x41, 0x41,// [
0x02, 0x04, 0x08, 0x10, 0x20,// "\"
0x41, 0x41, 0x7F, 0x00, 0x00,// ]
0x04, 0x02, 0x01, 0x02, 0x04,// ^
0x40, 0x40, 0x40, 0x40, 0x40,// _
0x00, 0x01, 0x02, 0x04, 0x00,// `
0x20, 0x54, 0x54, 0x54, 0x78,// a
0x7F, 0x48, 0x44, 0x44, 0x38,// b
0x38, 0x44, 0x44, 0x44, 0x20,// c
0x38, 0x44, 0x44, 0x48, 0x7F,// d
0x38, 0x54, 0x54, 0x54, 0x18,// e
0x08, 0x7E, 0x09, 0x01, 0x02,// f
0x08, 0x14, 0x54, 0x54, 0x3C,// g
0x7F, 0x08, 0x04, 0x04, 0x78,// h
0x00, 0x44, 0x7D, 0x40, 0x00,// i
0x20, 0x40, 0x44, 0x3D, 0x00,// j
0x00, 0x7F, 0x10, 0x28, 0x44,// k
0x00, 0x41, 0x7F, 0x40, 0x00,// l
0x7C, 0x04, 0x18, 0x04, 0x78,// m
0x7C, 0x08, 0x04, 0x04, 0x78,// n
0x38, 0x44, 0x44, 0x44, 0x38,// o
0x7C, 0x14, 0x14, 0x14, 0x08,// p
0x08, 0x14, 0x14, 0x18, 0x7C,// q
0x7C, 0x08, 0x04, 0x04, 0x08,// r
0x48, 0x54, 0x54, 0x54, 0x20,// s
0x04, 0x3F, 0x44, 0x40, 0x20,// t
0x3C, 0x40, 0x40, 0x20, 0x7C,// u
0x1C, 0x20, 0x40, 0x20, 0x1C,// v
0x3C, 0x40, 0x30, 0x40, 0x3C,// w
0x44, 0x28, 0x10, 0x28, 0x44,// x
0x0C, 0x50, 0x50, 0x50, 0x3C,// y
0x44, 0x64, 0x54, 0x4C, 0x44,// z
0x00, 0x08, 0x36, 0x41, 0x00,// {
0x00, 0x00, 0x7F, 0x00, 0x00,// |
0x00, 0x41, 0x36, 0x08, 0x00,// }
0x08, 0x08, 0x2A, 0x1C, 0x08,// ->
0x08, 0x1C, 0x2A, 0x08, 0x08 // <-
};
//
 
Last edited by a moderator:

Re: cd4514 led scroll circuits

There are two basic methods: the row scan and the column scan. The above code from Epegic uses the row scan method but your table is for column scanning (5 bytes/character). Now I don't have time enough to help you but download and study my prev. attachments in this thread, not one of them contains a bitmap-table for 7x5 row scanning (for example the PIC16 fixmsgs projects). I know they are using Proton Basic language but you can easily translate them to C.
 

Re: cd4514 led scroll circuits

I know the logic for working with either row scan or column scan, but i just want to understand how dispBuffer[row] value get updated after feeding 32 columns, i.e. after 4 loops, how to get the new 32 values for dispBuffer[row] so that I can feed them to rows to get the scrolling effect. That's all help I need.

---------- Post added at 04:03 ---------- Previous post was at 03:41 ----------

Dear Zuisti,
I downloaded the .zip fine and when I am trying to open the C code file, it is not showing the code properly. Can you please resend me the C code to my email id? It would be highly helpful for me as I am stuck with this for last couple of days. I believe your code will definitely help me to program the scrolling for my atmel microcontroller.
Kindly send me in email.
Thanks
Rajesh

---------- Post added at 04:05 ---------- Previous post was at 04:03 ----------

I refered your this post where you attached the files.

https://www.edaboard.com/threads/11364/#post574682
 

This is an example to scrolling display. Hope you can get an idea.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
unsigned char buffer_data[256]; 
 
...
...
...
 
void run_from_right()
{
  unsigned int a;
  unsigned char d;
 
  looping=speed; 
 
  for (a=0;a<num_char;a++)
  {
    xep_add++;
    d=xread(xep_add);       //read external eeprom
    shift_to_left();
    buffer_data[255]=font_7_5[0,d];
    display();          //refresh display
    shift_to_left();
    buffer_data[255]=font_7_5[1,d];
    display();
    shift_to_left();
    buffer_data[255]=font_7_5[2,d];
    display();
    shift_to_left();
    buffer_data[255]=font_7_5[3,d];
    display();
    shift_to_left();
    buffer_data[255]=font_7_5[4,d];
    display();
    shift_to_left();
    buffer_data[255]=0;
    display();
  };  
  looping=delaying; 
  looping*=44;
  if (looping!=0) 
  {
    display();
  }
}
 
 
void shift_to_left()
{
  unsigned int a;
  
  for (a=128;a<255;a++)
  {
    buffer_data[a]=buffer_data[a+1];
  }                      
}

 

Re: cd4514 led scroll circuits

Hi rajesh259;
Sorry but I do not use Atmel processors, I'm working with PICs (and only in Proteus). And for the relatively small memory uPs (such as the PIC12-16-18) I am using only the assembly or a near-asm language (as in Proton Basic, without its library routines), the C language is more memory-hungry.
Of course for the larger uPs (like PIC24-30-33, dsPIC, ARM) I use always the C.

My project what you referred is for a PIC and Hex-only, it doesn't contain the (basic) source files. Later I posted here complete Proteus projects too (full with source) but they all are for PIC and written in Proton Basic.
However, I think the algorithm (the method) is the same :-|
 

Hi Zuisti,
Its ok for me if I get the PIC code. I would understand the logic.
Thing is that, I have 32 columns connected via 4 shift registers HC595. The 8 rows are connected directly to the microcontroller Ports. I am using row scan. i.e. prepare the 32 colums data and feed to all the 8 rows 1-by-1.
I have all the hex values of ascii characters also.
Thanks
 

i am using atmega16 for 24x6 message display with the help of shift register.....and i have prepared the hardware too bt getting some problem in coding.....actually m not getting whether to use SPI and if that is used then what would be the coding....i have got a coding but that is 4 arduino so am unable to set a correlation between them....please help me out..
Code:
// defining all of the symbols
#define A {B01110000,B10001000,B10001000,B11111000,B10001000,B10001000}
#define B {B11110000,B10001000,B10001000,B11110000,B10001000,B11111000}
#define C {B11111000,B10000000,B10000000,B10000000,B10000000,B11111000}
#define D {B11110000,B10001000,B10001000,B10001000,B10001000,B11110000}
#define E {B11111000,B10000000,B10000000,B11110000,B10000000,B11111000}
#define F {B11111000,B10000000,B10000000,B11110000,B10000000,B10000000}
#define G {B01110000,B10001000,B10000000,B10011000,B10001000,B01110000}
#define H {B10001000,B10001000,B11111000,B10001000,B10001000,B10001000}
#define I {B11111000,B00100000,B00100000,B00100000,B00100000,B11111000}
#define J {B00111000,B00010000,B00010000,B00010000,B10010000,B01100000}
#define M {B10001000,B11011000,B10101000,B10101000,B10001000,B10001000}
#define N {B10001000,B11001000,B10101000,B10101000,B10011000,B10001000}
#define L {B10000000,B10000000,B10000000,B10000000,B10000000,B11111000}
#define O {B01110000,B10001000,B10001000,B10001000,B10001000,B01110000}
#define P {B11110000,B10001000,B10001000,B11110000,B10000000,B10000000}
#define Q {B01110000,B10001000,B10101000,B10011000,B01111000,B00001000}
#define R {B11110000,B10001000,B10001000,B11110000,B10001000,B10001000}
#define S {B01110000,B10001000,B01100000,B00010000,B10001000,B01110000}
#define K {B10001000,B10010000,B11100000,B11100000,B10010000,B10001000}
#define T {B11111000,B00100000,B00100000,B00100000,B00100000,B00100000}
#define U {B10001000,B10001000,B10001000,B10001000,B10001000,B01110000}
#define V {B10001000,B10001000,B10001000,B10001000,B01010000,B00100000}
#define W {B10001000,B10001000,B10101000,B10101000,B10101000,B01010000}
#define X {B10001000,B01010000,B00100000,B00100000,B01010000,B10001000}
#define Y {B10001000,B01010000,B00100000,B00100000,B00100000,B00100000}
#define Z {B11111000,B00001000,B00110000,B01100000,B10000000,B11111000}
#define LA{B00000000,B01110000,B00001000,B01111000,B10001000,B01111000}
#define LB{B10000000,B10000000,B10110000,B11001000,B10001000,B11110000}
#define LC{B00000000,B01110000,B10000000,B10000000,B10001000,B01110000}
#define LD{B00001000,B00001000,B01111000,B10001000,B10001000,B01111000}
#define LE{B00000000,B01110000,B10001000,B11111000,B10000000,B01110000}
#define LF{B00110000,B01001000,B01000000,B11100000,B01000000,B01000000}
#define LG{B00000000,B01111000,B10001000,B01111000,B00001000,B01110000}
#define LH{B10000000,B10000000,B10110000,B11001000,B10001000,B10001000}
#define LI{B00100000,B00000000,B01100000,B00100000,B00100000,B01111000}
#define LJ{B00010000,B00000000,B00111000,B00010000,B10010000,B01100000}
#define LK{B10000000,B10010000,B10100000,B11000000,B10100000,B10010000}
#define LL{B01100000,B00100000,B00100000,B00100000,B00100000,B01111000}
#define LM{B00000000,B00000000,B11010000,B10101000,B10101000,B10001000}
#define LN{B00000000,B00000000,B10110000,B11001000,B10001000,B10001000}
#define LO{B00000000,B01110000,B10001000,B10001000,B10001000,B01110000}
#define LP{B00000000,B11110000,B10001000,B11110000,B10000000,B10000000}
#define LQ{B00000000,B01101000,B10011000,B01111000,B00001000,B00001000}
#define LR{B00000000,B00000000,B10110000,B11001000,B10000000,B10000000}
#define LS{B00000000,B01110000,B10000000,B01110000,B00001000,B11110000}
#define LT{B01000000,B01000000,B11100000,B01000000,B01001000,B00110000}
#define LU{B00000000,B00000000,B10001000,B10001000,B10011000,B01101000}
#define LV{B00000000,B00000000,B10001000,B10001000,B01010000,B00100000}
#define LW{B00000000,B00000000,B10001000,B10101000,B10101000,B01010000}
#define LX{B00000000,B10001000,B01010000,B00100000,B01010000,B10001000}
#define LY{B00000000,B10001000,B10001000,B01111000,B00001000,B01110000}
#define LZ{B00000000,B11111000,B00010000,B00100000,B01000000,B11111000}
#define SPACE{B00000000,B00000000,B00000000,B00000000,B00000000,B00000000}
#define NUM0{B01110000,B10011000,B10101000,B10101000,B11001000,B01110000}
#define NUM1{B00100000,B01100000,B10100000,B00100000,B00100000,B01110000}
#define NUM2{B01110000,B10001000,B00001000,B01110000,B10000000,B11111000}
#define NUM3{B11110000,B00001000,B00001000,B01111000,B00001000,B11110000}
#define NUM4{B10001000,B10001000,B10001000,B11111000,B00001000,B00001000}
#define NUM5{B11111000,B10000000,B11110000,B00001000,B10001000,B01110000}
#define NUM6{B11111000,B10000000,B11111000,B10001000,B10001000,B11111000}
#define NUM7{B11111000,B00001000,B00001000,B01111000,B00001000,B00001000}
#define NUM8{B11111000,B10001000,B11111000,B10001000,B10001000,B11111000}
#define NUM9{B11111000,B10001000,B11111000,B00001000,B00001000,B11111000}
#define DEVIDE{B00001000,B00010000,B00100000,B00100000,B01000000,B10000000}
#define TWODOTS{B01100000,B01100000,B00000000,B00000000,B01100000,B01100000}
#define DOT{B00000000,B00000000,B00000000,B00000000,B01100000,B01100000}
#define COMA{B00000000,B00000000,B00000000,B00110000,B00110000,B01100000}
#define LINE{B00000000,B00000000,B11111000,B11111000,B00000000,B00000000}
#define QUASTION{B01110000,B10001000,B00010000,B00100000,B00000000,B00100000}
#define MARK{B00100000,B01110000,B01110000,B00100000,B00000000,B00100000}

int latchPin = 10; //latch pin of the shift register
int clockPin = 13; //clock pin of the shift register
int dataPin = 11; //data pin of the shift register
int clock = 9; //clock pin of the 4017 counter
int Reset = 8; //reset pin of the 4017 counter

// setting the pins for easy operation with PORTB
int latchPinPORTB = latchPin - 8;
int clockPinPORTB = clockPin - 8;
int dataPinPORTB = dataPin - 8;
int i = 0;
int incomingByte[44];// the incoming words go here
byte scrolling_word[6][3];// this is for the scrolling text
int array_turn=0;
byte patterns[100][6];
byte dummy_array[70][6] ={A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,SPACE,NUM0,NUM1,NUM2,NUM3,NUM4,NUM5,NUM6,NUM7,NUM8,NUM9,DEVIDE,TWODOTS,DOT,COMA,LINE,QUASTION,MARK,LA,LB,LC,LD,LE,LF,LG,LH,LI,LJ,LK,LL,LM,LN,LO,LP,LQ,LR,LS,LT,LU,LV,LW,LX,LY,LZ};

void setup(){
  Serial.begin(9600);//starting communicatino with the PC at 9600 boud
  // config for all the pins
  pinMode(dataPin,OUTPUT);
  pinMode(clockPin,OUTPUT);
  pinMode(latchPin,OUTPUT);
  pinMode(clock,OUTPUT);
  pinMode(Reset,OUTPUT);
  //reseting the 4017 counter
  digitalWrite(Reset,HIGH);
  digitalWrite(Reset,LOW);
  setupSPI();//starting SPI communication 
}

void display_word(int loops,byte word_print[][6],int num_patterns,int delay_langth){ // the main funcion for displaying and scrolling the word
  i = 0;
  for(int first=0;first<6;first++){ // reseting the scrolling_word array
    for(int second=0;second<5;second++)
     scrolling_word[first][second] = 0x00;
  }   
  
  for(int x=0;x<num_patterns;x++){//main loop that goes over all of the symbols
   for(int scroll=0;scroll<6;scroll++){// loop for scrolling, each symbols scrolls for 6 columns
   for(int r=0;r<6;r++){//going over all of the rows
      // this is the scrolling function it's like making a 3 byte word to scroll al once.
      scrolling_word[r][2] = (scrolling_word[r][2] << 1)+((scrolling_word[r][1] & 0x80) >> 7); 
      scrolling_word[r][1] = (scrolling_word[r][1] << 1)+((scrolling_word[r][0] & 0x80) >> 7); 
      scrolling_word[r][0] = (scrolling_word[r][0] << 1)+(((word_print[x][r]<<scroll)&0x80)>>7);
   }
      for(int t=0;t<delay_langth;t++){// a delay loop that just shows the same frame over and over to create a delay
        for(int y=0;y<6;y++){// the scaning loop that goes over all 6 rows
          if(i == 6){//if the 4017 counter counts up to 6 reset it
            digitalWrite(Reset,HIGH);
            digitalWrite(Reset,LOW);
            i = 0;// resetinf the counter
          }
          latchOff();// starint the communication with the shift registers
          spi_transfer(scrolling_word[y][2]);// sending info
          spi_transfer(scrolling_word[y][1]);
          spi_transfer(scrolling_word[y][0]);
          latchOn();
          delayMicroseconds(800);//a small delay for each row
          latchOff();// clearing the shift registers to make sure we will not get a ghosting effect
          spi_transfer(0);
          spi_transfer(0);
          spi_transfer(0);
          latchOn();
          // advensing the 4017 counter by one( we just send a positive pulse)
          digitalWrite(clock,HIGH);
          digitalWrite(clock,LOW);
          i++;
        }
      }
    } 
  } 
    finish_scroll(delay_langth);// calling for a function to finish scrolling the last 4 symbols
}

void finish_scroll(int delay_scroll){// this function finishs the scrolling and it's very similar to the display_word function
  for (int n=0;n<26;n++){
        for(int h=0;h<6;h++){ 
          scrolling_word[h][2] = (scrolling_word[h][2] << 1) | ((scrolling_word[h][1] & 0x80) >> 7); 
          scrolling_word[h][1] = (scrolling_word[h][1] << 1) | ((scrolling_word[h][0] & 0x80) >> 7); 
          scrolling_word[h][0] = (scrolling_word[h][0] << 1) | 0 ;
        }
      for(int t=0;t<delay_scroll;t++){
        for(int y=0;y<6;y++){
          if(i == 6){
            digitalWrite(Reset,HIGH);
            digitalWrite(Reset,LOW);
            i = 0;
          }
          latchOff();
          spi_transfer(scrolling_word[y][2]);
          spi_transfer(scrolling_word[y][1]);
          spi_transfer(scrolling_word[y][0]);
          latchOn();
          delayMicroseconds(800);
          latchOff();
          spi_transfer(0);
          spi_transfer(0);
          spi_transfer(0);
          latchOn();
          digitalWrite(clock,HIGH);
          digitalWrite(clock,LOW);
          i++;
        }
      }
    }
}

 
  void loop() {

	// send data only when you receive data:
	if(Serial.available() > 0){
		delay(100);
		incomingByte[array_turn] = Serial.read();// putting the symbol in the array
                array_turn++;//counting the number of incomming symbols
	}
           else{
             //this part is for getting the info we got and putting it in a form we could work with
             if(array_turn != 0){ 
               for(int az=0;az<array_turn;az++){//for latters
                 if((incomingByte[az] > 64 && incomingByte[az] < 91) || (incomingByte[az] > 96 && incomingByte[az] < 123)){
                  if(incomingByte[az] > 64 && incomingByte[az] < 91){
                   for(int lal=0;lal<6;lal++)                 
                 patterns[az][lal] = dummy_array[incomingByte[az] - 65][lal];
               }
               else{//for numbers
                 for(int lal=0;lal<6;lal++)                 
                 patterns[az][lal] = dummy_array[incomingByte[az] - 53][lal];
               }}
               else{// for odd symbols
                 switch(incomingByte[az]){
                case 32://space
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[26][lol];
                 break;
                case 33://mark
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[43][lol];
                 break;
                case 45://line
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[41][lol];
                 break;                 
                 case 44://coma
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[40][lol];
                 break;
                 case 46://dot
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[39][lol];
                 break;
                 case 47://dvide
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[37][lol];
                 break;
                 case 48://0
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[27][lol];
                 break;
                 case 49://1
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[28][lol];
                 break;
                 case 50://2
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[29][lol];
                 break;
                 case 51://3
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[30][lol];
                 break;
                 case 52://4
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[31][lol];
                 break;
                 case 53://5
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[32][lol];
                 break;
                 case 54://6
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[33][lol];
                 break;
                 case 55://7
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[34][lol];
                 break;
                 case 56://8
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[35][lol];
                 break;
                 case 57://9
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[36][lol];
                 break;
                 case 58://tow dots
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[38][lol];
                 break;
                 case 63://quastion
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[42][lol];
                 break;
                 default:
                 for(int lol=0;lol<6;lol++)                 
                 patterns[az][lol] = dummy_array[26][lol];
                 break; 
                 }
               }               
             }
           }
          display_word(1,patterns,array_turn,15);
          array_turn =0; 
         } 
       }
  
  //display_word(1,patterns,43,15);// calls for the display_pattern function and says that int loop = 15(if you do more loop the pattern whould scrrol slower).

void latchOn(){
  bitSet(PORTB,latchPinPORTB);
}

void latchOff(){
  bitClear(PORTB,latchPinPORTB);
}


void setupSPI(){// setting all the registers for SPI cummunication
  byte clr;
  SPCR |= ( (1<<SPE) | (1<<MSTR) ); // enable SPI as master
  //SPCR |= ( (1<<SPR1) | (1<<SPR0) ); // set prescaler bits
  SPCR &= ~( (1<<SPR1) | (1<<SPR0) ); // clear prescaler bits
  clr=SPSR; // clear SPI status reg
  clr=SPDR; // clear SPI data reg
  SPSR |= (1<<SPI2X); // set prescaler bits
  //SPSR &= ~(1<<SPI2X); // clear prescaler bits

  delay(10);
}
byte spi_transfer(byte data)
{
  SPDR = data;			  // Start the transmission
  while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
  {
  };
  return SPDR;			  // return the received byte, we don't need that
}
this is what is the code that i found....and the ckt diagram that i am using is...

and the pins that ar as pin 8,9,10,11,13,12 are all arduino pins......

so what changes should i make so as to make the whole project on atmega16
 

I never use the SPI in the running text programming because i think that will be useless.
For example, to display 8x16, then I put in 16 memory locations. Each column occupies one memory location.
because each output of HC595 represents one column, then need to send the data for row 1 of column 16, row 1 of column 15 and beyond.
When using spi, the spi's advantage would be futile because it still requires the arrangement of the bits before it is sent. Fill data with bit 16 - bit 8 and then send SPI Data.
Even be faster when using regular bit-bang method.
The next question, why should arrange display memory in the order as above? It is the consideration of the ease in making the next animation. For example, to shift the display to the left, just transfer buffer number 2 to the buffer number 1, the buffer number 3 to number 2 and so on. Except if we use 16 or 32-bits microcontroller, so it only need single word to handle one row when we make bit manipulation to animate the display.
 

I never use the SPI in the running text programming because i think that will be useless.
For example, to display 8x16, then I put in 16 memory locations. Each column occupies one memory location.
because each output of HC595 represents one column, then need to send the data for row 1 of column 16, row 1 of column 15 and beyond.
When using spi, the spi's advantage would be futile because it still requires the arrangement of the bits before it is sent. Fill data with bit 16 - bit 8 and then send SPI Data.
Even be faster when using regular bit-bang method.
The next question, why should arrange display memory in the order as above? It is the consideration of the ease in making the next animation. For example, to shift the display to the left, just transfer buffer number 2 to the buffer number 1, the buffer number 3 to number 2 and so on. Except if we use 16 or 32-bits microcontroller, so it only need single word to handle one row when we make bit manipulation to animate the display.

what is this bit bang method.....???
 

Bit bang is sending bits data that synchronized with clock. it's like SPI, but we have to make our own instructions.
For the speed, SPI is the fastest the send bits, but we need much time more to arrange 8-bit data before being sent.
I'm sorry i can't read your code, so here i attach the complete code and simulation.

untitled.GIF

View attachment Test.rar
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top