Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/19/03 11:55
Read: times


 
#48807 - lcd on 80c320
i'd posted a msg prev, with help on this, but i'm still stuck. i'm interfacing an lcd to the DS80c320. it wont display the string. i have disabled the interrupts, as i'm using int 0,int1,int2,3,4,5 pins of the 80c320. i've tried running a test program, just to make these pins high or low, which did work. but still, no display. any suggestions?
i'm attaching my code too. in C. using archimedes compiler. the serial port initialisation is for another part of the code. would appreciate any help...

rujuta #include "reg320.h"
#include <stdio.h>
#include <stdlib.h>
#define TIMER0_COUNT 0xF543

sbit LCD_data0 = P1^4;
sbit LCD_data1 = P1^5;
sbit LCD_data2 = P1^6;
sbit LCD_data3 = P1^7;
sbit LCD_RS = P3^2; // pin 12
sbit LCD_E = P3^3; // pin 13


int RxCount=0,timerflag,j,timertick,i;
char utc[12] = "UTC time is ";

void Init_serialport(void);
void timer0init(void);
void timer0delay(void);
void wrdata (char);
void wrctrl (char);
void initLCD (void);
void displaydata(void);

void main(void)
{
TA = 0xAA;
TA = 0x55;
EWT = 0;
Init_serialport();
initLCD();
timer0init();
while(1)
{
displaydata();
}
}

void Init_serialport( void ) // Function to init serial port
{
PCON = 0x80 ;
SCON0 = 0x50 ; // Setting mode1 for serial mode
SCON1 = 0x50 ;
TMOD = 0x21;
IE = 0xDA ; // enabling serial interrupt flag
EX0 = 0;
EX1 = 0;
EIE = 0x00; // disable ext interrupts
CKCON = 0xC7;
TR1 = 1; // count to set BR = 4.8K for 2nd serial port
TH1 = 0xFA;
}


void wrdata (char temp)
{
LCD_RS = 1;
LCD_data0 = temp&0x10;
LCD_data1 = temp&0x20; // write HI nibble
LCD_data2 = temp&0x40;
LCD_data3 = temp&0x80;
LCD_E = 1;
LCD_E = 1;
LCD_E = 0;
LCD_data0 = temp&0x01; // write LO nibble
LCD_data0 = temp&0x01;
LCD_data0 = temp&0x01;
LCD_data0 = temp&0x01;
LCD_E = 1;
LCD_E = 1;
LCD_E = 0;
timertick = 0;
while(timerflag!=1);
timerflag = 0;
}

void wrctrl (char temp)
{
LCD_RS = 0;
LCD_data0 = temp&0x10;
LCD_data1 = temp&0x20; // write HI nibble
LCD_data2 = temp&0x40;
LCD_data3 = temp&0x80;
LCD_E = 1;
LCD_E = 1;
LCD_E = 0;
LCD_data0 = temp&0x01; // write LO nibble
LCD_data0 = temp&0x01;
LCD_data0 = temp&0x01;
LCD_data0 = temp&0x01;
LCD_E = 1;
LCD_E = 1;
LCD_E = 0;
timertick = 0;
while(timerflag!=1);
timerflag = 0;
}

void initLCD(void)
{
wrctrl(0x28);
wrctrl(0x28);
wrctrl(0x0C);
wrctrl(0x06);
wrctrl(0x01);
}

void timer0init(void)
{
EA = 0;
EA = 0; // disable interrupts
timerflag = 0;
TR0 = 0; // stop timer 0
TL0 = (TIMER0_COUNT & 0x00FF);
TH0 = (TIMER0_COUNT >> 8);
PT0 = 0; // set low priority for timer 0
ET0 = 1; // enable timer 0 interrupt
TR0 = 1; // start timer 0
EA = 1;
}

void displaydata(void)
{
int i;
for(i=0;i<12;i++)
wrdata(utc[i]);
}


static void timer0delay(void) interrupt 1 using 1
{
unsigned int tmr_ovf;
TR0 = 0; // stop timer 0
tmr_ovf = (unsigned int)(TH0 << 8) + TL0;
tmr_ovf += TIMER0_COUNT;
TL0 = tmr_ovf & 0x00FF;
TH0 = tmr_ovf >> 8;
TR0 = 1; // start timer
timertick++;
if(timertick >= 2)
{
timerflag = 1;
timertick = 0;
}
}




List of 5 messages in thread
TopicAuthorDate
lcd on 80c320            01/01/70 00:00      
   RE: lcd on 80c320            01/01/70 00:00      
   RE: lcd on 80c320            01/01/70 00:00      
      RE: lcd on 80c320            01/01/70 00:00      
      RE: lcd on 80c320... kalpak            01/01/70 00:00      

Back to Subject List