what part of the program am i going to change if i use pic16f877a instead of pic16f628a?
... what is the function in the source code of zuisti 16char_l_u_d,
E_RD_ch Macro addr ' ch = Eread addr
.....
GoSub _E_RD_ch
Endm
E_WR Macro addr, value ' Ewrite addr, [value]
....
GoSub _E_WR
Endm
You have to cascade CD4017B. See CD4017B datasheet about cascading.
#include <avr/io.h>
#include <util/delay.h>
#include <avr/pgmspace.h>
//# define F_CPU 1000000UL
// led display
#define DATAPORT PORTA
#define shiftclock 0 // LED_RESET pin 11 or serial clock
#define latchclock 1 // LED_CLOCK pin 12 or register clock
#define leddata 3 // LED_DATA pin 14
#define SCROLL_DELAY 140 // multiple of 7 (use smaller numbers for faster scroll)
// global variables ***************************
//unsigned char bitcount,*inpt, *outpt,buffcnt = 0;
// led character definitions
// 5 data columns + 1 space
// for each character
unsigned char led_chars[1][6] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00, // space
0x00,0x00,0xfa,0x00,0x00,0x00, // !
0x00,0xe0,0x00,0xe0,0x00,0x00, // "
0x28,0xfe,0x28,0xfe,0x28,0x00, // #
0x24,0x54,0xfe,0x54,0x48,0x00, // $
0xc4,0xc8,0x10,0x26,0x46,0x00, // %
0x6c,0x92,0xaa,0x44,0x0a,0x00, // &
0x00,0xa0,0xc0,0x00,0x00,0x00, // '
0x00,0x38,0x44,0x82,0x00,0x00, // (
0x00,0x82,0x44,0x38,0x00,0x00, // )
0x28,0x10,0x7c,0x10,0x28,0x00, // *
0x10,0x10,0x7c,0x10,0x10,0x00, // +
0x00,0x0a,0x0c,0x00,0x00,0x00, // ,
0x10,0x10,0x10,0x10,0x10,0x00, // -
0x00,0x06,0x06,0x00,0x00,0x00, // .
0x04,0x08,0x10,0x20,0x40,0x00, // /
0x7c,0x8a,0x92,0xa2,0x7c,0x00, // 0
0x00,0x42,0xfe,0x02,0x00,0x00, // 1
0x42,0x86,0x8a,0x92,0x62,0x00, // 2
0x84,0x82,0xa2,0xd2,0x8c,0x00, // 3
0x18,0x28,0x48,0xfe,0x08,0x00, // 4
0xe5,0xa2,0xa2,0xa2,0x9c,0x00, // 5
0x3c,0x52,0x92,0x92,0x0c,0x00, // 6
0x80,0x8e,0x90,0xa0,0xc0,0x00, // 7
0x6c,0x92,0x92,0x92,0x6c,0x00, // 8
0x60,0x92,0x92,0x94,0x78,0x00, // 9
0x00,0x6c,0x6c,0x00,0x00,0x00, // :
0x00,0x6a,0x6c,0x00,0x00,0x00, // ;
0x10,0x28,0x44,0x82,0x00,0x00, // <
0x28,0x28,0x28,0x28,0x28,0x00, // =
0x00,0x82,0x44,0x28,0x10,0x00, // >
0x40,0x80,0x8a,0x90,0x60,0x00, // ?
0x4c,0x92,0x9e,0x82,0x7c,0x00, // @
0x7e,0x88,0x88,0x88,0x7e,0x00, // A
0xfe,0x92,0x92,0x92,0x6c,0x00, // B
0x7c,0x82,0x82,0x82,0x44,0x00, // C
0xfe,0x82,0x82,0x44,0x38,0x00, // D
0xfe,0x92,0x92,0x92,0x82,0x00, // E
0xfe,0x90,0x90,0x90,0x80,0x00, // F
0x7c,0x82,0x92,0x92,0x5e,0x00, // G
0xfe,0x10,0x10,0x10,0xfe,0x00, // H
0x00,0x82,0xfe,0x82,0x00,0x00, // I
0x04,0x02,0x82,0xfc,0x80,0x00, // J
0xfe,0x10,0x28,0x44,0x82,0x00, // K
0xfe,0x02,0x02,0x02,0x02,0x00, // L
0xfe,0x40,0x30,0x40,0xfe,0x00, // M
0xfe,0x20,0x10,0x08,0xfe,0x00, // N
0x7c,0x82,0x82,0x82,0x7c,0x00, // O
0xfe,0x90,0x90,0x90,0x60,0x00, // P
0x7c,0x82,0x8a,0x84,0x7a,0x00, // Q
0xfe,0x90,0x98,0x94,0x62,0x00, // R
0x62,0x92,0x92,0x92,0x8c,0x00, // S
0x80,0x80,0xfe,0x80,0x80,0x00, // T
0xfc,0x02,0x02,0x02,0xfc,0x00, // U
0xf8,0x04,0x02,0x04,0xf8,0x00, // V
0xfc,0x02,0x1c,0x02,0xfc,0x00, // W
0xc6,0x28,0x10,0x28,0xc6,0x00, // X
0xe0,0x10,0x0e,0x10,0xe0,0x00, // Y
0x86,0x8b,0x92,0xa2,0xc2,0x00, // Z
0x00,0xfe,0x82,0x82,0x00,0x00, // [
0x00,0x00,0x00,0x00,0x00,0x00, // *** do not remove this empty char ***
0x00,0x82,0x82,0xfe,0x00,0x00, // ]
0x20,0x40,0x80,0x40,0x20,0x00, // ^
0x02,0x02,0x02,0x02,0x02,0x00, // _
0x00,0x80,0x40,0x20,0x00,0x00, // `
0x04,0x2a,0x2a,0x2a,0x1e,0x00, // a
0xfe,0x12,0x22,0x22,0x1c,0x00, // b
0x1c,0x22,0x22,0x22,0x04,0x00, // c
0x1c,0x22,0x22,0x12,0xfe,0x00, // d
0x1c,0x2a,0x2a,0x2a,0x18,0x00, // e
0x10,0x7e,0x90,0x80,0x40,0x00, // f
0x30,0x4a,0x4a,0x4a,0x7c,0x00, // g
0xfe,0x10,0x20,0x20,0x1e,0x00, // h
0x00,0x22,0xbe,0x02,0x00,0x00, // i
0x04,0x02,0x22,0xbc,0x00,0x00, // j
0xfe,0x08,0x14,0x22,0x00,0x00, // k
0x00,0x82,0xfe,0x02,0x00,0x00, // l
0x3e,0x20,0x18,0x20,0x1e,0x00, // m
0x3e,0x10,0x20,0x20,0x1e,0x00, // n
0x1c,0x22,0x22,0x22,0x1c,0x00, // o
0x3e,0x28,0x28,0x28,0x10,0x00, // p
0x10,0x28,0x28,0x18,0x3e,0x00, // q
0x3e,0x10,0x20,0x20,0x10,0x00, // r
0x12,0x2a,0x2a,0x2a,0x04,0x00, // s
0x20,0xfc,0x22,0x02,0x04,0x00, // t
0x3c,0x02,0x02,0x04,0x3e,0x00, // u
0x38,0x04,0x02,0x04,0x38,0x00, // v
0x3c,0x02,0x0c,0x02,0x3c,0x00, // w
0x22,0x14,0x08,0x14,0x22,0x00, // x
0x30,0x0a,0x0a,0x0a,0x3c,0x00, // y
0x22,0x26,0x2a,0x32,0x22,0x00, // z
0x00,0x10,0x6c,0x82,0x00,0x00, // {
0x00,0x00,0xfe,0x00,0x00,0x00, // |
0x00,0x82,0x6c,0x10,0x00,0x00 }; // }
//***********************************************
void main()
{
unsigned int i,j;
unsigned char ch,row,temp;
// unsigned char PROGMEM *dataPtr, *tmpDataPtr;
unsigned char *dataptr, *tmpdataptr;
unsigned char messagelength, currentchar, charoffset, tmpcurrentchar,
tmpcharoffset, ledarray[16];
unsigned char message[] PROGMEM = {" ramayana "}; // 300 chars + 4 spaces at start and end of message
DDRA = 0xff;
DDRD = 0xff;
// initialise LED display (shift registers)
DATAPORT &= ~(1<<shiftclock); //shiftclock=0
DATAPORT &= ~(1<<latchclock); //latchclock=0
DATAPORT &= (1<<shiftclock); //shiftclock=1
charoffset = 0;
currentchar = 0;
dataptr = &led_chars[message[0] - 0x20][0];
// this loop is the heart of the scroll
// message is scrolled until a key is hit on the keyboard
while (1)
{
// load led array
tmpdataptr = dataptr;
tmpcharoffset = charoffset;
tmpcurrentchar = currentchar;
for (i = 0; i <= 15; i++)
{
ledarray[i] = *tmpdataptr++;
if (++tmpcharoffset==0x06)
{
tmpcharoffset = 0;
if (++tmpcurrentchar == messagelength)
tmpcurrentchar = 0;
tmpdataptr = &led_chars[message[tmpcurrentchar]-0x20][0];
}
}
if (++charoffset == 0x06)
{
charoffset = 0;
if (++currentchar == messagelength)
currentchar = 0;
}
dataptr = &led_chars[message[currentchar]-0x20][charoffset];
// display led array
row = 0x02;
for (j = 0;j <= SCROLL_DELAY; j++)
{
for (i = 0; i <= 15; i++)
{
temp = (ledarray[i] & row) ? 1 : 0;
DATAPORT &= (temp<<leddata);
DATAPORT |= (1<<latchclock);
DATAPORT &= ~(1<<latchclock);
}
PORTD= row;
row <<= 1; // next line to be switched on
if (!row) // if last line go back to the first line
row = 0x02;
_delay_us(800);
PORTD = 0x00;
}
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?