How do you feel about this article? Help us to provide better content for you.
Thank you! Your feedback has been received.
There was a problem submitting your feedback, please try again later.
What do you think of this article?
Hi to all. In this project, we will study the labview interface for Pic Microcontroller 18f452.Â
This microcontroller can measure voltage (0 to 500),current 0 to 5A, rpm 0 to 9999 and power.
The microcontroller is sending all values from serial port and pickit2 for programming.
The components we are using:
what is diode
Â
- Pic Microcontroller 18f452 (467-2126)
- LCD 2 x16 blue colour (791-6476)
- 1 relay 12 voltage single pole single throughÂ
- Transistors C945Â
- Optocupler PC817Â
- LEDs - red colour (228-5988) and green colour (228-6004)
- PT potential transformerÂ
- CT current transformer (173-0201)
- Bridge rectifierÂ
- rpm sensor
- resistor, capacitor, diode, connector   Â
- pic kit2 programmer
Â
Here is Pic Microcontroller 18f452 source code:
// LCD module conne
sbit LCD_RS at Rb2_bit;
sbit LCD_EN at Rb3_bit;
sbit LCD_D4 at Rb4_bit;
sbit LCD_D5 at Rb5_bit;
sbit LCD_D6 at Rb6_bit;
sbit LCD_D7 at Rb7_bit;
Â
sbit LCD_RS_Direction at TRISb2_bit;
sbit LCD_EN_Direction at TRISb3_bit;
sbit LCD_D4_Direction at TRISb4_bit;
sbit LCD_D5_Direction at TRISb5_bit;
sbit LCD_D6_Direction at TRISb6_bit;
sbit LCD_D7_Direction at TRISb7_bit;
// End LCD module connections
#define     rly1  portd.f0
#define     rly2  portd.f1
#define     rly3  portd.f2
#define     rly4  portd.f3
#define     rly5  portd.f4
Â
#define     sw1  portc.f0
Â
char *someText;
Â
Â
 long ADC_value,ADC_value1,v11,c11,t11,P11,c12,diff=0,avg=0,t22,v22;
int i=0,j=0,cnt=0,rpm=0;
char txt[7];
 unsigned short ii;
 unsigned int jj;
  unsigned char ch,kk,count=0;
 void send_volt();
 void send_current();
 void save_val();
Â
void timer0_Intit()
{
// Timer0 Registers:// 16-Bit Mode; Prescaler=1:16; TMRH Preset=B; TMRL Preset=DC; Freq=1.00Hz; Period=1.00 s
T0CON.TMR0ON = 1;// Timer0 On/Off Control bit:1=Enables Timer0 / 0=Stops Timer0
T0CON.T08BIT = 0;// Timer0 8-bit/16-bit Control bit: 1=8-bit timer/counter / 0=16-bit timer/counter
T0CON.T0CSÂ Â = 0;// TMR0 Clock Source Select bit: 0=Internal Clock (CLKO) / 1=Transition on T0CKI pin
T0CON.T0SEÂ Â = 0;// TMR0 Source Edge Select bit: 0=low/high / 1=high/low
T0CON.PSAÂ Â Â = 0;// Prescaler Assignment bit: 0=Prescaler is assigned; 1=NOT assigned/bypassed
T0CON.T0PS2Â = 0;// bits 2-0Â PS2:PS0: Prescaler Select bits
T0CON.T0PS1Â = 1;
T0CON.T0PS0Â = 1;
TMR0H = 0xB;Â Â Â // preset for Timer0 MSB register
TMR0L = 0xDC;Â Â Â // preset for Timer0 LSB register
}