void Calibrate() { T6963C_box(0,126,1,127, T6963C_WHITE); T6963C_write_text("TOUCH BOTTOM LEFT", 6, 6, 1); TP_Calibrate_Bottom_Left(); Delay_ms(700); T6963C_panelFill(0); T6963C_box(238, 1, 240, 0,T6963C_WHITE); T6963C_write_text("TOUCH UPPER RIGHT", 6, 6, 1); TP_Calibrate_Upper_Right(); Delay_ms(1500); }
void SP_BT_VN_Inactive() { SP_BT_VP1.Visible = 0; SP_BT_VP2.Visible = 0; SP_BT_VP3.Visible = 0; SP_BT_VN1.Visible = 0; SP_BT_VN2.Visible = 0; SP_BT_VN3.Visible = 0; T6963C_box(170,26,234,44,T6963C_BLACK); sprintf(strtmp,"%3.1f",00.0); UpdateLabel(&SP_LB_VC,strtmp); T6963C_box(170,59,234,74,T6963C_BLACK); SP_BT_VP1.Active = 0; SP_BT_VP2.Active = 0; SP_BT_VP3.Active = 0; SP_BT_VN1.Active = 0; SP_BT_VN2.Active = 0; SP_BT_VN3.Active = 0; }
void SH_BT_HVVP_Inactive() { SH_BT_HVVP1.Visible = 0; SH_BT_HVVP2.Visible = 0; SH_BT_HVVN2.Visible = 0; SH_BT_HVVN1.Visible = 0; SH_BT_HVCP1.Visible = 0; SH_BT_HVCP2.Visible = 0; SH_BT_HVCN2.Visible = 0; SH_BT_HVCN1.Visible = 0; T6963C_box(154,52,240,70,T6963C_BLACK); T6963C_box(154,102,240,124,T6963C_BLACK); SH_BT_HVVP1.Active = 0; SH_BT_HVVP2.Active = 0; SH_BT_HVVN2.Active = 0; SH_BT_HVVN1.Active = 0; SH_BT_HVCP1.Active = 0; SH_BT_HVCP2.Active = 0; SH_BT_HVCN2.Active = 0; SH_BT_HVCN1.Active = 0; }
void SM_LB_FreqClick() { // Pulse Rate need change if (SM_BT_PRP.Visible == 0) // Show buttons { SM_BT_PRP.Visible = 1; SM_BT_PRN.Visible = 1; DrawButton(&SM_BT_PRP); DrawButton(&SM_BT_PRN); SM_BT_PRP.Active = 1; SM_BT_PRN.Active = 1; } //if pulse rate change buttons are shown, update the puserate flag. else { SM_BT_PRP.Visible = 0; SM_BT_PRN.Visible = 0; // Clear Buttons T6963C_box(183,33,203,48,T6963C_BLACK); T6963C_box(183,70,203,85,T6963C_BLACK); SM_BT_PRP.Active = 0; SM_BT_PRN.Active = 0; // Update Pulse Rate ? } }
void SP_BT_Inactive() { SP_BT_VN_Inactive(); SP_BT_PRP.Visible = 0; SP_BT_PRN.Visible = 0; SP_BT_20PRP.Visible = 0; SP_BT_CT.Visible = 0; SP_BT_CC.Visible = 0; SP_BT_PRP.Visible = 0; T6963C_box(170,78,234,110,T6963C_BLACK); SP_BT_PRP.Active = 0; SP_BT_PRN.Active = 0; SP_BT_20PRP.Active = 0; SP_BT_CT.Active = 0; SP_BT_CC.Active = 0; SP_BT_100CT.Active = 0; }
void ManVoltLabClick() { // ManualMode Change Voltage //if vol change button is hided, display +- buttons/activate them if (SM_BT_VP1.Visible == 0) { SM_BT_VP1.Visible = 1; SM_BT_VP2.Visible = 1; SM_BT_VP3.Visible = 1; SM_BT_VN1.Visible = 1; SM_BT_VN2.Visible = 1; SM_BT_VN3.Visible = 1; DrawButton(&SM_BT_VP1); DrawButton(&SM_BT_VP2); DrawButton(&SM_BT_VP3); DrawButton(&SM_BT_VN1); DrawButton(&SM_BT_VN2); DrawButton(&SM_BT_VN3); SM_BT_VP1.Active = 1; SM_BT_VP2.Active = 1; SM_BT_VP3.Active = 1; SM_BT_VN1.Active = 1; SM_BT_VN2.Active = 1; SM_BT_VN3.Active = 1; } //if vol change button is shown, set the voltage and hide/activate them. else { SM_BT_VP1.Visible = 0; SM_BT_VP2.Visible = 0; SM_BT_VP3.Visible = 0; SM_BT_VN1.Visible = 0; SM_BT_VN2.Visible = 0; SM_BT_VN3.Visible = 0; T6963C_box(87,33,151,48,T6963C_BLACK); T6963C_box(87,70,151,85,T6963C_BLACK); SM_BT_VP1.Active = 0; SM_BT_VP2.Active = 0; SM_BT_VP3.Active = 0; SM_BT_VN1.Active = 0; SM_BT_VN2.Active = 0; SM_BT_VN3.Active = 0; // Update high voltage PWM //PWMvalue = Voltset*1024/MaxVoltLimit, proxmity *5 ; //PWM1_10bit(Voltset*1023.0/200); //PWM2_10bit(Voltset*5+23);*/ setvolt(Voltset); //Vfeed = (int) ADC_Get_Sample (5); //Debug code //longtmp = Voltset; //LongToStr(longtmp*1024/MaxVoltLimit,strtmp); //LongToStr(Voltset*5,strtmp); //T6963C_Write_Text_Adv(strtmp, 100, 0); //Fine feedback adjustment } }
void main() { ANCON0 = 0; ANCON1 = 0; ANCON2 = 0; ANCON0.B0 = 1; // Configure RA0 pin as analog ANCON0.B1 = 1; // Configure RA1 pin as analog TRISA.B0 = 1; // Set RA0 pin as input TRISA.B1 = 1; // Set RA1 pin as input ADC_Init(); T6963C_ctrlce_Direction = 0; T6963C_ctrlce = 0; // Enable T6963C T6963C_ctrlmd_Direction = 0; T6963C_ctrlmd = 0; // Column number select T6963C_ctrlfs_Direction = 0; T6963C_ctrlfs = 0; // Wide Font BacklightRed_Direction = 0; // Set backlight signals as outputs BacklightGreen_Direction = 0; BacklightBlue_Direction = 0; BacklightRed = 0; // Turn on Red component of back light BacklightGreen = 0; // Turn on Green component of back light BacklightBlue = 0; // Turn on Blue component of back light // Initialize T6963C T6963C_init(240, 128, 8); T6963C_graphics(1); T6963C_text(1); T6963C_cursor(0); TP_Init(240, 128, 0, 1); // Initialize touch panel TP_Set_ADC_Threshold(500); // Set touch panel ADC threshold T6963C_graphics(1); T6963C_text(1); T6963C_panelFill(0); T6963C_write_text("CALIBRATION", 8, 6, 1); Delay_ms(2000); T6963C_panelFill(0); Calibrate(); T6963C_panelFill(0); T6963C_write_text("WRITE ON SCREEN", 7, 6, 1) ; Delay_ms(1000); T6963C_panelFill(0); //Draw menus: T6963C_box(0,0,42,7,T6963C_WHITE); T6963C_write_text(clear_msg,0,0,0); T6963C_box(200,0,240,7,T6963C_WHITE); T6963C_write_text(erase_msg,25,0,0); T6963C_box(57,0,65,7,T6963C_WHITE); T6963C_write_char('R',7,0,0); T6963C_box(73,0,81,7,T6963C_WHITE); T6963C_write_char('G',9,0,0); T6963C_box(89,0,97,7,T6963C_WHITE); T6963C_write_char('B',11,0,0); T6963C_box(105,0,145,7,T6963C_WHITE); T6963C_write_text("Light",13,0,0); write_erase = 1; while (1) { if (TP_Press_Detect()) { // get coordinates if (TP_Get_Coordinates(&x_coord240, &y_coord128) == 0){ // If clear is pressed if ((x_coord240 < 32) && (y_coord128 < 8)) { T6963C_panelFill(0); // Draw menus: T6963C_box(0,0,42,7,T6963C_WHITE); T6963C_write_text(clear_msg,0,0,0); T6963C_box(200,0,240,7,T6963C_WHITE); if (write_erase) T6963C_write_text(erase_msg,25,0,0); else T6963C_write_text(write_msg,25,0,0); T6963C_box(57,0,65,7,T6963C_WHITE); T6963C_write_char('R',7,0,0); T6963C_box(73,0,81,7,T6963C_WHITE); T6963C_write_char('G',9,0,0); T6963C_box(89,0,97,7,T6963C_WHITE); T6963C_write_char('B',11,0,0); T6963C_box(105,0,145,7,T6963C_WHITE); T6963C_write_text("Light",13,0,0); } // If write/erase is pressed: if ((x_coord240 > 201) && (y_coord128 < 8)) { if (write_erase) { write_erase = 0; T6963C_write_text(write_msg,25,0,0); Delay_ms(200); } else { write_erase = 1; T6963C_write_text(erase_msg,25,0,0); Delay_ms(200); } } // If R button is pressed: if ((x_coord240 >= 57) && (x_coord240 <= 65) && (y_coord128 <= 7)) { PORTC.F2 = !PORTC.F2; // Red Delay_ms(100); } // If G button is pressed: if ((x_coord240 >= 73) && (x_coord240 <= 81) && (y_coord128 <= 7)) { PORTC.F1 = !PORTC.F1; // Green Delay_ms(100); } // If B button is pressed: if ((x_coord240 >= 89) && (x_coord240 <= 97) && (y_coord128 <= 7)) { PORTG.F0 = !PORTG.F0; // Blue Delay_ms(100); } // If backlight button is pressed: if ((x_coord240 >= 105) && (x_coord240 <= 146) && (y_coord128 <= 7)) { PORTC.F2 = !PORTC.F2; // Red PORTC.F1 = !PORTC.F1; // Green PORTG.F0 = !PORTG.F0; // Blue Delay_ms(100); } // Draw on the screen if (y_coord128 > 8) { if (write_erase) T6963C_dot(x_coord240, y_coord128, T6963C_WHITE); else T6963C_dot(x_coord240, y_coord128, T6963C_BLACK); } } } } }