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.

Led Moving Sign 16x96 MCU ATMEL ATMEGA8

Status
Not open for further replies.
this is main program

Code:
 /*
    Dot Matrix Display Controller
    Chip: ATMEGA128
    Serial EEPROM: AT24C256
    RTC: DS1307
    Matrix Size: 16 Row x [n] Column
    Character programmable via: PS-2 Keyboard & Serial DB-9 (using custom data downloader)
    RTC format hh:mm:ss and DD:MM:YY
    */

    #define F_CPU 14745600UL //11059200UL

    // define of I/O Register Control Ports
    #define RCLK PC0
    #define SCLK PC1
    #define SERIAL PC2
    #define DATAPORT PORTC
    #define DATADDR DDRC

    #include <avr/io.h>
    #include <avr/eeprom.h>
    #include <avr/interrupt.h>
    #include <avr/pgmspace.h>
    #include <avr/wdt.h>
    #include <util/delay.h>
    #include <stdlib.h>
    #include <string.h>

    #include "font16x16.h"
    #include "font5x7.h"
    #include "twi.h"
    #include "ds1307.h"
    #include "seeprom.h"
    #include "animasi.h"
    #include "ps2kbd.c"
    #include "uart.h"
    #include "menu.h"

    volatile uint8_t baris, kolom, baris_aktif, modul_aktif;
    volatile uint16_t geser, prescaler;

    #define SCLK_LOW() {DATAPORT &= ~(1<<SCLK);}
    #define SCLK_HIGH() {DATAPORT |= (1<<SCLK);}
    #define SCLOCK() {SCLK_LOW();SCLK_HIGH();}

    #define RCLK_LOW() {DATAPORT &= ~(1<<RCLK);}
    #define RCLK_HIGH() {DATAPORT |= (1<<RCLK);}
    #define RCLOCK() {RCLK_LOW();RCLK_HIGH();}

    void reset_register() // MEMBERSIHKAN REGISTER
    {
    uint8_t kolom;
    for(kolom = 0; kolom < (COL_PER_MODUL+16); kolom++)
    {
    buffer[kolom] = 0;
    DATAPORT &= ~(1<<SERIAL);
    SCLOCK();
    }
    RCLOCK();
    }

    ISR(TIMER3_COMPA_vect, ISR_NOBLOCK) // Periode interrupt 30ms, interrupt memakan waktu 21ms, sisa waktu 9ms
    {
    for(baris_aktif = 0; baris_aktif < 16; baris_aktif++)
    {
    for(baris = 0; baris < 16; baris++) // buat nyalakan
    {
    if(baris == baris_aktif) DATAPORT |= (1<<SERIAL); else DATAPORT &= ~(1<<SERIAL);
    SCLOCK();
    }
    for(kolom = 0; kolom < COL_PER_MODUL; kolom++)
    {
    temp = buffer[kolom];
    if(temp & (1<<baris_aktif)) DATAPORT |= (1<<SERIAL); else DATAPORT &= ~(1<<SERIAL);
    SCLOCK();
    }
    RCLOCK();
    _delay_us(330); // delay 350us
    for(kolom = 0; kolom < (COL_PER_MODUL+16); kolom++) // buat matikan
    {
    DATAPORT &= ~(1<<SERIAL);
    SCLOCK();
    }
    RCLOCK();
    }
    }

    int main(void)
    {
    DATADDR |= (1<<SERIAL) | (1<<SCLK) | (1<<RCLK); // inisialisasi port-port
    DATAPORT &= ~((1<<SERIAL) | (1<<SCLK) | (1<<RCLK));

    JUMLAH_MODUL = eeprom_read_byte(&JUMLAH_MODULE); // jumlah modul
    if(JUMLAH_MODUL > 160)
    {
    JUMLAH_MODUL = 1;
    eeprom_write_byte(&JUMLAH_MODULE, JUMLAH_MODUL);
    }
    COL_PER_MODUL = eeprom_read_byte(&COL_PER_MODULE); // jumlah kolom per modul
    if(COL_PER_MODUL > 160)
    {
    COL_PER_MODUL = 32;
    eeprom_write_byte(&COL_PER_MODULE, COL_PER_MODUL);
    }

    lebar_display = JUMLAH_MODUL * COL_PER_MODUL;
    slot = 0;
    buffer_enable = 1;
    program_kbd = 0;

    reset_register();

    twiInit(10);

    UART_Init(MYUBRR); // inisialisasi komunikasi serial
    kbd_init(); // inisialisasi keyboard
    sei(); // enable global interrupt

    delay(2000);
    kbd_send(0xFF); // kirim perintah untuk me-reset keyboard
    delay(1000); // tunggu bentar
    key = kbd_get_scancode(); // baca balasan dari keyboard
    if(key == 0xFA) // jika 0xFA maka ada keyboard
    {
    write_menu_flash(PSTR("PROG MODE"),1);
    write_menu_flash(PSTR("F1=HELP"),2);
    help_position = 0;
    TIMER3_INIT(); // inisialisasi interupsi timer 2 untuk scanning display
    program_kbd = 1;
    while(program_kbd) do_menu(); // proses memprogram kalimat menggunakan keyboard
    }

    kbd_release();

    TIMER0_INIT(); // inisialisasi interupsi timer 0 untuk timeout komunikasi serial
    TIMER1_INIT(); // inisialisasi interupsi timer 1 untuk update jam dan tanggal
    TIMER3_INIT(); // inisialisasi interupsi timer 2 untuk scanning display

    slot = 0;

    wdt_enable(WDTO_2S);

    while(1)
    {
    MAX_SLOT = eeprom_read_byte(&MAX_SLOTE);
    if(slot<MAX_SLOT)
    {
    kecepatan_masuk = SEEPROM_READ(((uint16_t) slot * 1024) + 2);
    kecepatan_keluar = SEEPROM_READ(((uint16_t) slot * 1024) + 3);
    transition_delay = ((uint16_t) SEEPROM_READ(((uint16_t) slot * 1024) + 4) << 8) + SEEPROM_READ(((uint16_t) slot * 1024) + 5);
    if(transition_delay > 10000) transition_delay = 500;

    copy_buffer(slot);
    animasi_masuk(slot);
    if(SEEPROM_READ((uint16_t) slot * 1024) != GESER_KIRI2) // kalo bukan geser kiri terooos, maka proses seperti biasa
    {
    wait(transition_delay);
    animasi_keluar(slot);
    }
    slot++;
    } else slot = 0;
    }
    return 0;
    }
 
adiba said:
this is main program

/*
Dot Matrix Display Controller
Chip: ATMEGA128
Serial EEPROM: AT24C256
RTC: DS1307
Matrix Size: 16 Row x [n] Column
Character programmable via: PS-2 Keyboard & Serial DB-9 (using custom data downloader)
RTC format hh:mm:ss and DD:MM:YY
*/

#define F_CPU 14745600UL //11059200UL

// define of I/O Register Control Ports
#define RCLK PC0
#define SCLK PC1
#define SERIAL PC2
#define DATAPORT PORTC
#define DATADDR DDRC

#include <avr/io.h>
#include <avr/eeprom.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/wdt.h>
#include <util/delay.h>
#include <stdlib.h>
#include <string.h>

#include "font16x16.h"
#include "font5x7.h"
#include "twi.h"
#include "ds1307.h"
#include "seeprom.h"
#include "animasi.h"
#include "ps2kbd.c"
#include "uart.h"
#include "menu.h"

volatile uint8_t baris, kolom, baris_aktif, modul_aktif;
volatile uint16_t geser, prescaler;

#define SCLK_LOW() {DATAPORT &= ~(1<<SCLK);}
#define SCLK_HIGH() {DATAPORT |= (1<<SCLK);}
#define SCLOCK() {SCLK_LOW();SCLK_HIGH();}

#define RCLK_LOW() {DATAPORT &= ~(1<<RCLK);}
#define RCLK_HIGH() {DATAPORT |= (1<<RCLK);}
#define RCLOCK() {RCLK_LOW();RCLK_HIGH();}

void reset_register() // MEMBERSIHKAN REGISTER
{
uint8_t kolom;
for(kolom = 0; kolom < (COL_PER_MODUL+16); kolom++)
{
buffer[kolom] = 0;
DATAPORT &= ~(1<<SERIAL);
SCLOCK();
}
RCLOCK();
}

ISR(TIMER3_COMPA_vect, ISR_NOBLOCK) // Periode interrupt 30ms, interrupt memakan waktu 21ms, sisa waktu 9ms
{
for(baris_aktif = 0; baris_aktif < 16; baris_aktif++)
{
for(baris = 0; baris < 16; baris++) // buat nyalakan
{
if(baris == baris_aktif) DATAPORT |= (1<<SERIAL); else DATAPORT &= ~(1<<SERIAL);
SCLOCK();
}
for(kolom = 0; kolom < COL_PER_MODUL; kolom++)
{
temp = buffer[kolom];
if(temp & (1<<baris_aktif)) DATAPORT |= (1<<SERIAL); else DATAPORT &= ~(1<<SERIAL);
SCLOCK();
}
RCLOCK();
_delay_us(330); // delay 350us
for(kolom = 0; kolom < (COL_PER_MODUL+16); kolom++) // buat matikan
{
DATAPORT &= ~(1<<SERIAL);
SCLOCK();
}
RCLOCK();
}
}

int main(void)
{
DATADDR |= (1<<SERIAL) | (1<<SCLK) | (1<<RCLK); // inisialisasi port-port
DATAPORT &= ~((1<<SERIAL) | (1<<SCLK) | (1<<RCLK));

JUMLAH_MODUL = eeprom_read_byte(&JUMLAH_MODULE); // jumlah modul
if(JUMLAH_MODUL > 160)
{
JUMLAH_MODUL = 1;
eeprom_write_byte(&JUMLAH_MODULE, JUMLAH_MODUL);
}
COL_PER_MODUL = eeprom_read_byte(&COL_PER_MODULE); // jumlah kolom per modul
if(COL_PER_MODUL > 160)
{
COL_PER_MODUL = 32;
eeprom_write_byte(&COL_PER_MODULE, COL_PER_MODUL);
}

lebar_display = JUMLAH_MODUL * COL_PER_MODUL;
slot = 0;
buffer_enable = 1;
program_kbd = 0;

reset_register();

twiInit(10);

UART_Init(MYUBRR); // inisialisasi komunikasi serial
kbd_init(); // inisialisasi keyboard
sei(); // enable global interrupt

delay(2000);
kbd_send(0xFF); // kirim perintah untuk me-reset keyboard
delay(1000); // tunggu bentar
key = kbd_get_scancode(); // baca balasan dari keyboard
if(key == 0xFA) // jika 0xFA maka ada keyboard
{
write_menu_flash(PSTR("PROG MODE"),1);
write_menu_flash(PSTR("F1=HELP"),2);
help_position = 0;
TIMER3_INIT(); // inisialisasi interupsi timer 2 untuk scanning display
program_kbd = 1;
while(program_kbd) do_menu(); // proses memprogram kalimat menggunakan keyboard
}

kbd_release();

TIMER0_INIT(); // inisialisasi interupsi timer 0 untuk timeout komunikasi serial
TIMER1_INIT(); // inisialisasi interupsi timer 1 untuk update jam dan tanggal
TIMER3_INIT(); // inisialisasi interupsi timer 2 untuk scanning display

slot = 0;

wdt_enable(WDTO_2S);

while(1)
{
MAX_SLOT = eeprom_read_byte(&MAX_SLOTE);
if(slot<MAX_SLOT)
{
kecepatan_masuk = SEEPROM_READ(((uint16_t) slot * 1024) + 2);
kecepatan_keluar = SEEPROM_READ(((uint16_t) slot * 1024) + 3);
transition_delay = ((uint16_t) SEEPROM_READ(((uint16_t) slot * 1024) + 4) << 8) + SEEPROM_READ(((uint16_t) slot * 1024) + 5);
if(transition_delay > 10000) transition_delay = 500;

copy_buffer(slot);
animasi_masuk(slot);
if(SEEPROM_READ((uint16_t) slot * 1024) != GESER_KIRI2) // kalo bukan geser kiri terooos, maka proses seperti biasa
{
wait(transition_delay);
animasi_keluar(slot);
}
slot++;
} else slot = 0;
}
return 0;
}

thank for your code it would be great if you share include files also as zip file

regards
Fragrance
 
i think newbie can learn lots from these exampls great work keep it up
 
Thanks for sharing but the given file is just a block diagram. Please upload the schematic, block diagram, and the code with hex file in a zif or rar file which will be highly beneficial to many. Also mention some details about the keyboard as what keyboard is used and how to connect it. Cheers
 
hello.. good day!
is it right to use MCU ATMEL ATMEGA8 in our project "electronic message board via sms"?... we are planning to use gsm module in our circuit...
 
anemokid said:
hello.. good day!
is it right to use MCU ATMEL ATMEGA8 in our project "electronic message board via sms"?... we are planning to use gsm module in our circuit...
yes..Mega 8 should work well. The said task can too be done with 89S52 or any PIC micros. Its all up to your knowledge.
Cheers
 
  • Like
Reactions: ian_ahadian

    ian_ahadian

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
can you share the full skematik project here my fren ......i want make project like yours!
 
  • Like
Reactions: enker

    V

    Points: 2
    Helpful Answer Positive Rating

    enker

    Points: 2
    Helpful Answer Positive Rating
can uplod d circuit diagarm ..plz
 

    V

    Points: 2
    Helpful Answer Positive Rating
Re: Led Moving Sign 16x96 MCU ATMEL ATMEGA128

http://www.youtube.com/watch?[/url]
MOD: I have deleted the video link as i strongly guess you are just here to advertising your products through Youtube videos. As you can see numerous members have posted the need for a schematic of your 16 x 96 Display project which is not yet posted. If you like to share, share it in the right way. Thus your next post will be the schematic or a warning for any video link. We usually kick out spammers.
 

    V

    Points: 2
    Helpful Answer Positive Rating
Thanks for the moderation. I was actually intending to issue the OP a warning.
 
  • Like
Reactions: sathish83

    sathish83

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
i'm now working in AVR for led scrolling.
what is in the some header files that u added the program?
"font16x16.h"
"font5x7.h"
"twi.h"
"ds1307.h"
"seeprom.h"
"animasi.h"
"ps2kbd.c"
"uart.h"
"menu.h"
 

I am a hobbyist of Electronics & Microcontroller want to make LED Moving/Static 7 x 80 Sign using 89s52 & 74HC595 my hardware is completed but for the software I want some help from expert.

Is there any one expert? who can help me to complete it.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top