 |

|
Elektronika.lt portalo forumas
Jūs esate neprisijungęs lankytojas. Norint dalyvauti diskusijose, būtina užsiregistruoti ir prisijungti prie forumo.
Prisijungę galėsite kurti naujas temas, atsakyti į kitų užduotus klausimus, balsuoti forumo apklausose.
Administracija pasilieka teisę pašalinti pasisakymus bei dalyvius,
kurie nesilaiko forumo taisyklių.
Pastebėjus nusižengimus, prašome pranešti.
Dabar yra 2025 05 22, 01:23. Visos datos yra GMT + 2 valandos.
|
|
|
 |
Forumas » Mikrovaldikliai » Atmega 16 + PRC1602 lcd
|
Jūs negalite rašyti naujų pranešimų į šį forumą Jūs negalite atsakinėti į pranešimus šiame forume Jūs negalite redaguoti savo pranešimų šiame forume Jūs negalite ištrinti savo pranešimų šiame forume Jūs negalite dalyvauti apklausose šiame forume
|
|
|
 |
Atmega 16 + PRC1602 lcd |
Parašytas: 2010 11 14, 19:04 |
|
|
|
Sweiki , gal kas esate dare projekteli su situo lcd ir turite koda ji paleisti ? .
bandziau naudoti pries tai aptarta Centronic coda , bet gavau tik visa eile pilnu kvadraciuku. |
|
|
|
|
 |
Atmega 16 + PRC1602 lcd |
Parašytas: 2010 11 14, 23:56 |
|
|
|
Pa Googlines radau , padoru koda su situo lcd hd44780 .
bet vistiek kvadraciukus rodo .
kame problema ? jungimas lyg ir geras . |
|
|
|
|
 |
 |
 |
 |
Atmega 16 + PRC1602 lcd |
Parašytas: 2010 11 15, 18:13 |
|
|
|
tai va kad nezinau ar stovi , tai jusu klausiu .
http://svn.clifford.at/metaparts/trunk/datasheets/DS_c980d86266b304d85b4c852fc9719c94.pdf ce datashytas nk neraso apie hd44780
bet seip tie visi bitai , iniacijaimas , tas pats kiek ziurejau , bet jai galit uzmeskit aki .
kodas cia
Kodas: |
/*----------------------------------------------------------------
-------------------- HEADER FILES -------------------------------
-----------------------------------------------------------------*/
#include<avr/io.h>
#include<string.h>
#include <util/delay.h>
/*----------------------------------------------------------------
------------- DEFINITIONS -------------------------------------
-----------------------------------------------------------------*/
#define DATA_DDR DDRA // ENTER THE PORT WHICH CONTROLS
#define DATA_PORT PORTA // THE DATA PINS D0 TO D7
#define CONTROL_DDR DDRB // ENTER THE PORT WHICH CONTROLS
#define CONTROL_PORT PORTB // THE CONTROL PINS
#define Enable 2 // CoNNECTION OF ENABLE TO PIN OF ABOVE PORT
#define RS 0 // CoNNECTION OF RegisterSelect TO PIN OF ABOVE PORT
#define RW 1 // CoNNECTION OF Read/~Write TO PIN OF ABOVE PORT
#define CONTROL_MASK 0X07 // CHANGE THIS VALUE CONSIDERING THE PINS ABOVE AS HIGH
/*----------------------------------------------------------------
-------------CONTROL BITS OF LCD --------------------------------
-----------------------------------------------------------------*/
#define Set_Enable CONTROL_PORT |=_BV(Enable) // THE MACROS HERE ARE
#define Clear_Enable CONTROL_PORT &=~_BV(Enable) //SELF EXPLANATORY
#define Write_Lcd CONTROL_PORT &=~_BV(RW) //
#define Read_Lcd CONTROL_PORT |=_BV(RW) //
#define Select_InstructionRegister CONTROL_PORT &=~_BV(RS) //
#define Select_DataRegister CONTROL_PORT |=_BV(RS) //
#define Data_Lcd(b) DATA_PORT=b //
#define delay(b) _delay_ms(b) //
/*----------------------------------------------------------------
-----------------FUNCTION DECLARATIONS ---------------------------
-----------------------------------------------------------------*/
void Init_Ports(void); // Initialise Ports , Necessary for selecting input output pins in the MCU
void Init_Lcd(void); // Initialise LCD , Necessary for starting and clearing LCD screen
void Lcd_Send(unsigned char a); // For sending a character to the LCD
void newline(void); // For printing characters on the next line in the LCD
/*----------------------------------------------------------------
----------------MAIN FUNCTION--------------------------------------
-----------------------------------------------------------------*/
void main()
{
int x;
x=10;
int len,len1,len2;
char str1[] = "labas "; // String to be printed in 1st line
char str2[] = "pasauli"; // String to be printed in 2nd line
Init_Ports();
Init_Lcd();
len1=strlen(str1);
len2=strlen(str2);
for (len=0;len<len1;len++) // Printing the first string
Lcd_Send(str1[len]);
newline(); // Go to new line
for (len=0;len<len2;len++) // Printing the 2nd string
Lcd_Send(str2[len]);
while(1){
}
}
/*----------------------------------------------------------------
-----------------SEND A CHARACTER TO LCD-------------------------
-----------------------------------------------------------------*/
void Lcd_Send(unsigned char a)
{
Select_DataRegister; // Declares information that follows as data and not instruction
Write_Lcd; // Declared information is to be written
Data_Lcd(a); // Send the character passed to the function to LCD to write
Set_Enable; // Sets enable,
delay(5); // and then
Clear_Enable; // Clears it,
delay(5); // to be ready for next character.
}
/*----------------------------------------------------------------
-----------------FUNCTIONS TO INITIALIZE PORTS--------------------
-----------------------------------------------------------------*/
void Init_Ports(void)
{
DATA_DDR=0XFF; // Setting data port for output
CONTROL_DDR=CONTROL_MASK; // Setting selected pins of control port for output
CONTROL_PORT&=~(_BV(Enable)|_BV(RS )|_BV(RW)); // Setting values to 0 at start
}
/*----------------------------------------------------------------
------------FUNCTION TO INITIATE LCD -----------------------------
-----------------------------------------------------------------*/
void Init_Lcd(void)
{
char init[10];
int i;
init[0] = 0x01; // Initialises the display
init[1] = 0x38; // 8 - Bit Operation, 2 Line Display,5*8 Dot Character Font
init[2] = 0x0e; // Turns on display and cursor
init[3] = 0x06; // Entry Mode Set
init[4] = 0x80; // Sets DDRAM address to beginning of screen
Select_InstructionRegister;
Write_Lcd;
delay(15);
for(i=0;i<5;i++)
{
Data_Lcd(init[i]);
Set_Enable;
delay(5);
Clear_Enable;
delay(5);
}
}
/*----------------------------------------------------------------
------------FUNCTION TO GOTO NEXT LINE IN LCD --------------------
-----------------------------------------------------------------*/
void newline(void)
{
delay(5);
Select_InstructionRegister; // Declares information to follow as instruction
Data_Lcd(0xc0); // Code to go to next line of LCD
Set_Enable; // -- Enable cycle --
delay(5); // | |
Clear_Enable; // | |
delay(5); // -- --
}
|
kodas ne mano , per proteus veikia , seip nk pakeitinet nereikejo , tik is portc pakeiciau i port b berods , ir sumeciau reset, enable ,r/w - pagal mano poreikius.
bet va snd prisijungiau atmega bandziau jtag paziuret ar ijungtas , tai nuskaito bitus . ir poto bandai kazka vel daryt ,raso unable to probe.
perkrauni , maitinima , ir vel gali pvz irasyt softa nauja , bet irasai , dar karta bandai kazka daryt , vel unable to probe.
[/quote] |
|
|
|
|
 |
 |
Atmega 16 + PRC1602 lcd |
Parašytas: 2010 11 15, 18:27 |
|
|
|
rodo kad i jungtas jtagas , ir visa jo eilute ir dar apacioje cksel0
kodel neina man bitu nustatynet ?
dabar prijunges 4mhz kvarca ir reike padaryt kad pagal ji dirbtu ?
pagal bitus ieina , kad dabar dirba su vidiniu ant 1 mhz. |
|
|
|
|
 |
Atmega 16 + PRC1602 lcd |
Parašytas: 2010 11 15, 23:41 |
|
|
|
Kad hd44780 nu jau zuzinojom, kaip ir whiskas turetu veikti . ir kokiais atvejais ta j tag reike isjunkti ?
ir kaip man dabar nustatyiti , fuse bitus , normaliai ? |
|
|
|
|
 |
Atmega 16 + PRC1602 lcd |
Parašytas: 2010 11 16, 23:36 |
|
|
|
BaltaS rašo: |
Kad hd44780 nu jau zuzinojom, kaip ir whiskas turetu veikti . ir kokiais atvejais ta j tag reike isjunkti ?
ir kaip man dabar nustatyiti , fuse bitus , normaliai ? |
Niekas nezinot , kas su ja pasidare ir kaip isjungt jtag , gal full erase padetu ?
nes su mega168 viskas ok veike lcd. dabar kaip laikrodi naudoju
tik per mazai koju, gerokai. |
|
|
|
|
|
 |
Google paieška forume |
|
 |
Naujos temos forume |
|
 |
FS25 Tractors
Farming Simulator 25 Mods,
FS25 Maps,
FS25 Trucks |
 |
ETS2 Mods
ETS2 Trucks,
ETS2 Bus,
Euro Truck Simulator 2 Mods
|
 |
FS22 Tractors
Farming Simulator 22 Mods,
FS22 Maps,
FS25 Mods |
 |
VAT calculator
VAT number check,
What is VAT,
How much is VAT |
 |
FS25 Mods
FS25 Harvesters,
FS25 Tractors Mods,
FS25 Maps Mods |
 |
Dantų protezavimas
All on 4 implantai,
Endodontija mikroskopu,
Dantų implantacija |
 |
FS25 Mods
FS25 Maps,
FS25 Cheats,
FS25 Install Mods |
 |
FS25 Mods
Farming Simulator 25 Mods,
FS25 Maps |
 |
ATS Trailers
American Truck Simulator Mods,
ATS Trucks,
ATS Maps |
 |
Football Training Kit
Football Training Equipment,
Football Skills,
Football Training |
|

|
 |