Skip to main content

labview interface for Pic Microcontroller 18f452

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.

Raspberry based Web Server

microcontroller_labeview_3e560e1c066744cafd91fc58104f0f27725a598c.png

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

}

I am engineer from MicroSolution We deal in microcontroller programming and hardware
DesignSpark Electrical Logolinkedin