This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I have connected LCD display, 4 keys (mode, up, down, enter) and RTC through Tiva C launch pad 123GXL .. Everything works fine until I change the time through keypad.
My application ask for change in time via keypad (it will be displayed on LCD) and RTC should start from the changed time.
I am trying to change the Minute counter by up/down keys but once the RTC has fetched time from initial values it does not changes.
Below is my code:
//***************************************************************************** // This program has LCD dispaly, RTC, keypad control code // // // //***************************************************************************** #include <stdint.h> #include <stdbool.h> #include <stdint.h> #include "inc/hw_i2c.h" #include "inc/hw_gpio.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "driverlib/i2c.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" #include "utils/ustdlib.h" #include <stdint.h> #include <stdbool.h> #include "inc/hw_types.h" #include "driverlib/sysctl.h" #include "driverlib/interrupt.h" #include "driverlib/gpio.h" #include "driverlib/timer.h" #include "inc/hw_memmap.h" #include "driverlib/debug.h" #include "driverlib/fpu.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" #include "inc/hw_gpio.h" #include "inc/hw_sysctl.h" #include "inc/tm4c123gh6pm.h" // Defination of variables #define databits GPIO_PORTB_DATA_R #define SLAVE_ADDRESS 0x68 void ConfigureUART(void); void initI2C(); unsigned char dec2bcd(unsigned char val); unsigned char bcd2dec(unsigned char val); unsigned char dec2aski(unsigned char val); unsigned long sec=35 , min = 26 ,hour = 10, min1,min2,min3 ; unsigned long tsec, tmin, thour, DOW,DOW_askii; unsigned long day=6 , date=7 , month=8 , year=15 ; unsigned long tdate, tmonth, tyear,tday, ldate1, ldate2; unsigned long lsec, lmin, lhour, ldate, lday, lmonth, lyear,n_askii; #define databits GPIO_PORTB_DATA_R unsigned long DOW, DOW_askii; int n=0,n1=0,n2=0,t; int k=0, d=0, e=0; int m,count; int m1,m2,m3,m0; int Mode_Pin=0; int UP_Pin=0; int Down_Pin=0; int Enter_Pin=0; int b0=0; int b1=0; int b2=0; int b3=0; int c1=0; int scan=0; int count0; int count1; int count2; int count3; int count4; int count5,a_count5_x, a_count5_y; int count6; int count7; int count8; int count9; unsigned long a_count0, a_count1, a_count2, a_count3, a_count4, a_count5, a_count6, a_count7, a_count8, a_count9; volatile unsigned long ulLoop; unsigned char Last_Value = 1; // // The error routine that is called if the driver library encounters an error. // #ifdef DEBUG void __error__(char *pcFilename, uint32_t ui32Line) { } #endif //LCD code //PB0 to PB1 Data Lines //PA6 = RS //PA7 = E //R/W = GND // PE0 = Mode // PE1 = UP // PE2 = Down // PE3 = Enter // LCD Code //************************************************************************************************** #define databits GPIO_PORTB_DATA_R unsigned long DOW, DOW_askii; void LCD_command(unsigned char data) { SysCtlDelay(SysCtlClockGet()/5000); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x00); SysCtlDelay(10); GPIOPinWrite(GPIO_PORTB_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,data); // DATA Pins for 4 bit mode SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x00); databits=data>>4; SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x80); SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x00); SysCtlDelay(10); databits=data; SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x80); SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x00); SysCtlDelay(10); } void LCD_command_8bit(unsigned char data) { SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x00); SysCtlDelay(15000); GPIOPinWrite(GPIO_PORTB_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,data); // DATA Pins for 4 bit mode SysCtlDelay(15000); databits=(data); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x80); SysCtlDelay(15000); SysCtlDelay(SysCtlClockGet()/5000); // 1 sec delay databits=(data); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x00); SysCtlDelay(15000); } void LCD_data(unsigned char data) { SysCtlDelay(SysCtlClockGet()/5000); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x00); GPIOPinWrite(GPIO_PORTB_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,data); // DATA Pins for 4 bit mode GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6,GPIO_PIN_6); SysCtlDelay(10); databits=data>>4; SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7,GPIO_PIN_7); SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7,0x00); SysCtlDelay(10); databits=data; SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7,GPIO_PIN_7); SysCtlDelay(10); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7,0x00); SysCtlDelay(10); } void clear (void) { LCD_command(0x01); SysCtlDelay(30000); } void LCD_Init() { clear(); SysCtlDelay(SysCtlClockGet()/15); LCD_command_8bit(0x30); SysCtlDelay(SysCtlClockGet()/30); LCD_command_8bit(0x30); SysCtlDelay(SysCtlClockGet()/30); LCD_command_8bit(0x30); SysCtlDelay(SysCtlClockGet()/30); LCD_command_8bit(0x20); SysCtlDelay(SysCtlClockGet()/30); LCD_command(0x28); SysCtlDelay(SysCtlClockGet()/30); LCD_command(0x0C); SysCtlDelay(SysCtlClockGet()/30); clear(); } void LCD_String_Display(unsigned char *str) { while(*str) { LCD_data(*str); str++; } return; } // Keypad code void up()//loop to move up { //Mode_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0); UP_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1); //anup if(UP_Pin==0) { n=n+1; //k=0; } } void down()//loop to move down { Down_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_2); if(Down_Pin==0) { n=n-1; //d=d+1; // k=0; } } void select()//loop to select the mode { Mode_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0); if(Mode_Pin==0) { k=k+1; n=0; d=0; e=0; count1=0; count2=0; count3=0; count4=0; // count=0; } } void enter()//loop to select the mode { Enter_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_3); if(Enter_Pin==0) { d=d+1; e=e+1; } } void rtcwrite() { min = min3; t=0; } void mode() { if (k==0) { switch(n) { case 0: LCD_String_Display("M101: I/P Voltage"); LCD_command(0xC0); LCD_String_Display("Vin : 90 V"); break; case 1: LCD_String_Display("M102:I/P Current"); LCD_command(0xC0); LCD_String_Display("Iin : 200 A"); break; case 2: n=0; LCD_String_Display("M101: I/P Voltage"); LCD_command(0xC0); LCD_String_Display("Vin : 90 V"); break; case -1: n=1; LCD_String_Display("M102:I/P Current"); LCD_command(0xC0); LCD_String_Display("Iin : 200 A"); break; } } else if (k==1) { switch(n) { case 0: LCD_String_Display("M201:Fault Status"); LCD_command(0xC0); LCD_String_Display("F1: I/P OV Volt"); break; case 1: LCD_String_Display("M202:Fault Status"); LCD_command(0xC0); LCD_String_Display("F2: I/P UN Volt"); break; case 2: n=0; LCD_String_Display("M201:Fault Status"); LCD_command(0xC0); LCD_String_Display("F1: I/P OV Volt"); break; case -1: n=1; LCD_String_Display("M202:Fault Status"); LCD_command(0xC0); LCD_String_Display("F2: I/P UN Volt"); break; } } else if (k==2) { count=0; switch (d) { case 0: LCD_String_Display("M301: Enter Password"); // LCD_command(0xC0); break; case 1: LCD_String_Display("M301: Enter Password"); LCD_command(0xC0); a_count1 = ((count1/0xA) | 0x30); a_count1 = ((count1 % 0xA) | 0x30); LCD_data(a_count1); if(UP_Pin==0) { count1=count1+1; n=0; } if(Down_Pin==0) { count1=count1-1; n=0; } break; case 2: LCD_String_Display("M301: Enter Password"); LCD_command(0xC0); a_count2 = ((count2/0xA) | 0x30); a_count2 = ((count2 % 0xA) | 0x30); LCD_data(a_count1); LCD_data(a_count2); if(UP_Pin==0) { count2=count2+1; n=0; } if(Down_Pin==0) { count2=count2-1; n=0; } break; case 3: LCD_String_Display("M301: Enter Password"); LCD_command(0xC0); a_count3 = ((count3/0xA) | 0x30); a_count3 = ((count3 % 0xA) | 0x30); LCD_data(a_count1); LCD_data(a_count2); LCD_data(a_count3); if(UP_Pin==0) { count3=count3+1; n=0; } if(Down_Pin==0) { count3=count3-1; n=0; } break; case 4: LCD_String_Display("M301: Enter Password"); LCD_command(0xC0); a_count4 = ((count4/0xA) | 0x30); a_count4 = ((count4 % 0xA) | 0x30); LCD_data(a_count1); LCD_data(a_count2); LCD_data(a_count3); LCD_data(a_count4); if(UP_Pin==0) { count4=count4+1; n=0; } if(Down_Pin==0) { count4=count4-1; n=0; } break; case 5: if (count == count1 + count2 + count3 + count4) { LCD_String_Display("M302: RTC Setting"); LCD_command(0xC0); min1 = ((tmin/0xA) | 0x30); LCD_data(min1); min2 = ((tmin % 0xA) | 0x30); LCD_data(min2); if(UP_Pin==0) { tmin=tmin+1; } if(Down_Pin==0) { tmin=tmin-1; } min3 = ((min1 - 0x30)*0xA) + ((min2 - 0x30)); // t=0; } else { LCD_String_Display("M301: Enter Password"); LCD_command(0xC0); LCD_String_Display("Wrong Password"); } break; case 6: // min1 = ((a_count5_x - 0x30)*0xA) + ((a_count5_y - 0x30)); rtcwrite(); d=5; // count1=0; // count2=0; // count3=0; // count4=0; break; } } else if (k==3) { switch(n) { case 0: LCD_String_Display("M101: I/P Voltage"); LCD_command(0xC0); LCD_String_Display("Vin : 90 V"); break; case 1: LCD_String_Display("M102:I/P Current"); LCD_command(0xC0); LCD_String_Display("Iin : 200 A"); break; case 2: n=0; LCD_String_Display("M101: I/P Voltage"); LCD_command(0xC0); LCD_String_Display("Vin : 90 V"); break; case -1: n=1; LCD_String_Display("M102:I/P Current"); LCD_command(0xC0); LCD_String_Display("Iin : 200 A"); break; } } } void display()//loop to define the display, when clock is not being displayed. { switch(k) { case 0: mode(); break; case 1: mode(); break; case 2: mode(); break; case 3: k=0; mode(); break; } SysCtlDelay(2000000); } void keycheck()//checking the status of the keys pressed { m0=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0); m1=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1); m2=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_2); m3=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_3); //if(m0==0| m1==0 | m2==0)//checking the buttons if(m0==0) //dont use m3 i.e button 4th(as it is being used for reverting back to orginal conditions) { m=0;//value to intialize the interrupt. } else { m=1; } uint32_t ui32Period; SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); if ( m==0)//timer interrupt being enabled at a particular { ui32Period = (SysCtlClockGet()/10)/2; TimerLoadSet(TIMER0_BASE, TIMER_A, ui32Period -1); IntEnable(INT_TIMER0A); TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); IntMasterEnable(); TimerEnable(TIMER0_BASE, TIMER_A); while(m==0) { } } } void Timer0IntHandler() { clear(); TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); Mode_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0); UP_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_1); Down_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_2); Enter_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_3); //if(Down_Pin==0| UP_Pin==0| Mode_Pin==0) if(Mode_Pin==0) { while(e<20 && scan<80) //while(1) { clear(); down();//caliing the function to naviagte downwards up();//caliing the function to naviagte upwards display();//caliing the function to display the funtion select(); enter(); scan=scan+1; SysCtlDelay(5000); Enter_Pin=GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_3); } } else if(e>=20) { m++;//initailizing the values k=0;//initailizing the values n=0;//initailizing the values e=0; scan=0; } else if(scan>=80) { m++;//initailizing the values k=0;//initailizing the values n=0;//initailizing the values e=0; scan=0; } } int main() { ROM_SysCtlClockSet (SYSCTL_SYSDIV_16|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); SysCtlDelay(SysCtlClockGet()/5000); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE,GPIO_PIN_6|GPIO_PIN_7); GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); LCD_Init(); clear(); LCD_String_Display(" We Answer "); SysCtlDelay(2000000); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE,GPIO_PIN_6|GPIO_PIN_7); LCD_Init(); clear(); initI2C(); // ConfigureUART(); clear(); mode(); keycheck(); GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6|GPIO_PIN_7,0x00); while (1) { while(t==0) { keycheck(); mode(); I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS, false); I2CMasterDataPut(I2C2_BASE,0); // 29_7 I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS, false); // 29_7 I2CMasterDataPut(I2C2_BASE,0); // 29_7 I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START); // comment when you dont want to change time while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterDataPut(I2C2_BASE,dec2bcd(sec)); //29_7 I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT); //29_7 while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterDataPut(I2C2_BASE,dec2bcd(min)); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterDataPut(I2C2_BASE,dec2bcd(hour)); //29_7 I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_SEND_CONT); //29_7 while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterDataPut(I2C2_BASE,dec2bcd(day)); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterDataPut(I2C2_BASE,dec2bcd(date)); I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_SEND_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterDataPut(I2C2_BASE,dec2bcd(month)); I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_SEND_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterDataPut(I2C2_BASE,dec2bcd(year)); I2CMasterControl(I2C2_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); t=1; } //while(1) // { keycheck(); I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS, false); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterDataPut(I2C2_BASE,0x00); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS, true); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); sec = I2CMasterDataGet(I2C2_BASE); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); min = I2CMasterDataGet(I2C2_BASE); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); hour = I2CMasterDataGet(I2C2_BASE); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); day = I2CMasterDataGet(I2C2_BASE); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); while(I2CMasterBusy(I2C2_BASE)); date = I2CMasterDataGet(I2C2_BASE); ROM_SysCtlDelay(3000); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); month = I2CMasterDataGet(I2C2_BASE); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); year = I2CMasterDataGet(I2C2_BASE); I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH); while(I2CMasterBusy(I2C2_BASE)); ROM_SysCtlDelay(3000); tsec = bcd2dec(sec)&0x7f; tmin = bcd2dec(min); thour = bcd2dec(hour)&0x3f; tday = bcd2dec(day); tdate = bcd2dec(date); tmonth = bcd2dec(month); tyear = bcd2dec(year); DOW = tday; if(Last_Value != tsec) { clear(); if (thour<= 23) { lhour = ((thour/0xA) | 0x30); LCD_data(lhour); lhour = ((thour % 0xA) | 0x30); LCD_data(lhour); } else { thour = 0; lhour = ((thour/0xA) | 0x30); LCD_data(lhour); lhour = ((thour % 0xA) | 0x30); LCD_data(lhour); } LCD_data(58); if (tmin<=59) { lmin = ((tmin/0xA) | 0x30); LCD_data(lmin); lmin = ((tmin % 0xA) | 0x30); LCD_data(lmin); } else { tmin = 0; lmin = ((tmin/0xA) | 0x30); LCD_data(lmin); lmin = ((tmin % 0xA) | 0x30); LCD_data(lmin); } LCD_data(58); if (tsec<=59) { lsec = ((tsec/0xA) | 0x30); LCD_data(lsec); lsec = ((tsec % 0xA) | 0x30); LCD_data(lsec); } else { tsec=0; lsec = ((tsec/0xA) | 0x30); LCD_data(lsec); lsec = ((tsec % 0xA) | 0x30); LCD_data(lsec); } LCD_command(0xC0); ldate = ((tdate/0xA) | 0x30); LCD_data(ldate); ldate = ((tdate % 0xA) | 0x30); LCD_data(ldate); LCD_data(47); lmonth = ((tmonth/0xA) | 0x30); LCD_data(lmonth); lmonth = ((tmonth % 0xA) | 0x30); LCD_data(lmonth); LCD_data(47); lyear = ((tyear/0xA) | 0x30); LCD_data(lyear); lyear = ((tyear % 0xA) | 0x30); LCD_data(lyear); LCD_data(32); switch(DOW) { case 1: LCD_String_Display("Sun"); break; case 2: LCD_String_Display("Mon"); break; case 3: LCD_String_Display("Tue"); break; case 4: LCD_String_Display("Wed"); break; case 5: LCD_String_Display("Thu"); break; case 6: LCD_String_Display("Fri"); break; case 7: LCD_String_Display("Sat"); break; } Last_Value = tsec; tsec = 0; keycheck(); } else { I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_ERROR_STOP); } } } //} void initI2C() { ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_I2C2); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C2); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); GPIOPinTypeI2CSCL(GPIO_PORTE_BASE, GPIO_PIN_4); ROM_GPIOPinTypeI2C(GPIO_PORTE_BASE, GPIO_PIN_5); ROM_GPIOPinConfigure(GPIO_PE4_I2C2SCL); ROM_GPIOPinConfigure(GPIO_PE5_I2C2SDA); I2CMasterInitExpClk(I2C2_BASE, SysCtlClockGet(), false); ROM_SysCtlDelay(100000); } unsigned char dec2bcd(unsigned char val) { return ((val/0xA*0x10)+(val%0xA)); } unsigned char bcd2dec(unsigned char val) { return ((val/0x10*0xA)+(val%0x10)); }
Sorry for lots of code.
I do not understand how to change the time through keypad. Please share if someone has some idea.
Thank you.
Thank you for that detail, my friend. Surely Amit, others, myself appreciate the time & effort you've spent which make the forum more valuable to all.
Now - in the attempt to "generalize" your issue so that others may benefit across many MCU peripherals:
We've often observed clients - who "protest" the time/effort required to create such "stylized" test boards - spend huge amounts of time/effort due to failed or improper "haywire" test connections & methodology.
The ability to "reuse" a known good item "pays for itself" in short order. - unique, rapidly deployed "clip ons" - in time - cost far more in lost productivity than a proper "stylized" small board.