??? 07/21/04 17:58 Read: times |
#74637 - RE: LPC932 Interrupt Solution Responding to: ???'s previous message |
here is the program...I hope someone sees the problem.
I did not include LCD software definitions and procedures because that is not a problem at all. thanks for all of your help! J.C. #include <Reg932.h> #include <stdio.h> #include <String.h> #include <intrins.h> #include <absacc.h> #include "definitions.h" /**************Main code starts here**************/ extern void delay1 (unsigned int z) small reentrant { unsigned int a; for (a = 0; a < z; a++) { //waste time ; } } void Main(void) { OCA = 0; OCB = 0; OCC = 0; OCD = 0; P0 = 0x01; P2 = 0x00; P1 = 0x00; P3 = 0x00; init(); brkrst_init(); initialize_LCD(); CMP1 = 0x00; CMP2 = 0x00; P1 |= 0x18; display(ent); Sec = 0; Min = 0; Hr = 0; Dy = 0; c_counter(); //Timer is called here read_par = 0x1A; IT1 = 1; EX1 = 1; //tdata(); // if I disble External Int. 1 and call tdata from here then it works fine. while(1) { PCON |= 0x00; } } void init(void) { P0M1 = 0x03; P0M2 = 0xEC; P1M1 = 0x00; P1M2 = 0xFF; P2M1 = 0x00; P2M2 = 0xFF; P1M1 |= 0x18; P1M2 &= 0xF7; P3M1 = 0x00; P3M2 = 0xFF; ES = 1; EA = 1; } UART break detect { SCON = 0x50; SSTAT = 0x00; BRGR0 = 0xF0; BRGR1 = 0x02; BRGCON = 0x03; AUXR1 |= 0x80; // Clock Low Power Select } void UART(void) interrupt 4 { RI = 0; // clear receive interrupt flag } void c_counter(void) { ET0 =1; //TR0 = 0; TMOD |= 0x01; TAMOD = 0x00; T0_counter(); EA = 1; //TR0 = 1; } void T0_counter(void) { TR0 = 0; TH0 = (65535-34816)/256; TL0 = (65535-34816)%256; TF0 = 0; TR0 = 1; } void Card_Present(void) interrupt 2 { EX1 = 0; // int. is called and disabled WriteInstrReg (CLEAR_DISPLAY); display(p_start); // disp. a message t_counter = 0; read_par = 0x1A; tdata(); // Function to display data // every n Sec is called here return; } void timer0(void) interrupt 1 { T0_counter(); if (--ticks == 0) { ticks = 108; if (++Sec == 4) Sec = 0; } return; } void tdata (void) { //Sec = 0; while(Sec < 3); // wait as long as Sec is < 3 do { Sec = 0; // reset Sec counter read_par--; WriteInstrReg (CLEAR_DISPLAY); WriteInstrReg(0x80); if (read_par == 0x19) display(mid); // display parameter name if (read_par == 0x17) display(sequ); // display parameter name if (read_par == 0x15) display(time); // display parameter name if (read_par == 0x13) display(costu); // display parameter name if (read_par == 0x11) display(tlit); // display parameter name if (read_par == 0x0F) display(no_w); // display parameter name if (read_par == 0x0D) display(wdt); // display parameter name numdsp(9, ++recvar, 0, 10000); // display value WriteInstrReg (CLEAR_DISPLAY); WriteInstrReg(0xC0); // display line two while (Sec < 3); } while (++t_counter < 7); } /**************Main code ends here**************/ /******"definitions.h" file starts here*********/ //All definitions void init(void); void brkrst_init(void); void display (char* dat); void tdata (void); void c_counter(void); void T0_counter(void); unsigned char ticks = 108, Min, Hr, Dy, read_par; volatile char Sec; // changed to a volatile type def. unsigned char recvar = 0, t_counter = 0; unsigned char code ent [] = "Enter"; /******"definitions.h" file starts here*********/ |
Topic | Author | Date |
LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution | 01/01/70 00:00 | |
RE: LPC932 Interrupt Solution![]() | 01/01/70 00:00 |