Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Two digit counter using pic16f72

Status
Not open for further replies.
Firstly 1k isn't going to be very bright... @3mA ( still should be visible..).. When using a 20Mhz crystal the config should be "0x3F72"

__CONFIG(LVP_OFF & BOREN_ON & PWRTE_ON & WDTE_OFF & FOSC_HS);


LVP is on PORTB .3 so turning LVP off is a good idea.. Are you using Low Voltage Programming???.
 
__CONFIG(LVP_OFF & BOREN_ON & PWRTE_ON & WDTE_OFF & FOSC_HS);

LVP is on PORTB .3 so turning LVP off is a good idea.. Are you using Low Voltage Programming???.

How to know that i have PICKIT 2
 
How to know that i have PICKIT 2
Then the answer is probably no.... If you are unfamiliar with LVP, then you most certainly aren't using it!!

Just use the first config statement... Is the LED's lighting yet?
 
you said:
hello,
I Have doubt when i use 877A with this setting it work fine.
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);

I assumed with that statement, it was now working
 
Hello again,

The PIC16F72 i was talking in my previous POST is Floating port B and PORTC at digital output
that mean neither 0 nor 1,why?
 
No, I have TRISB=0 and TRISC=0; why it is Floating?
PORTB=0xff and PORTC=0xff; both are giving floating nor 0 and 1
what may be the reason or that crystal is not working due to which the output is float.
 
Then the answer is probably no.... If you are unfamiliar with LVP, then you most certainly aren't using it!!

Just use the first config statement... Is the LED's lighting yet?
What is LVP for?
The purpose of LVP is to allow complete programming using only Vcc i.e. 5V and no higher voltage and that means you don't have to have a dedicated power supply voltage e.g. 12 V to program the device. i.e. you could program multiple devices on a board from one central microcontroller using LVP.

My programer also work on 5V from PC that mean Yes..!!
 
Not sure it has 4 BJT may be..

what to do for post #49 what should be the problem should 72 should be changed and checked?
 
Ok Ritesh! I'm confused now... Are you using the same code from post #30 or the code from post #1 ... If so what is the processor.. pic16f72 or pi16f877a..

The code in post #30 is correct.... If the pic shows floating on all pins, then its not running... What crystal are you using??
4 or 20Mhz?
 
The problem is only in PIC16F72 and Crystal is 20Mhz
Yes code is correct because the MP LAB SIM is working fine...
 
So re-cap

Pic16f72.... Running( supposedly) at 20Mhz... You are setting the ports to output .. ie.. "0" but there is no output and the ports appear as floating!!!

1) The pic isn't running... OSC issues or MCLR not set correctly.
2) The pic IS running..... Internal damage..
3) Hardware limitations..... Not enough current... dry solder joint....
 
Hi,
I was working on Ultra sonic sensor for water level with electric Motor, i need to calculate the distance i have this code working fine in PIC16F877 and i need to know the 58 value actually it was float so, i convert to decimal.
know i will add LCD this part i will do myself.
but i want to increase it sensitivity.
a = a/58; //Converts Time to Distance
a = a + 1; //Distance Calibration



C:
#include <htc.h>
__CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
#define _XTAL_FREQ 20000000
main(){
  TRISB = 0b00010000;
   RB5=1;  
__delay_ms(1000);
RB5=0;
__delay_ms(500);
RB5=1;  
__delay_ms(1000);
RB5=0;
__delay_ms(500);

while(1){





int a;
  T1CON = 0x10;  //Initialize Timer Module
  TMR1H = 0;  //Sets the Initial Value of Timer
  TMR1L = 0;  //Sets the Initial Value of Timer

  RB0 = 1;  //TRIGGER HIGH
  __delay_us(10);  //10uS Delay
  RB0 = 0;  //TRIGGER LOW

  while(!RB4);  //Waiting for Echo
  TMR1ON=1;  //Timer Starts
  while(RB4);  //Waiting for Echo goes LOW
  TMR1ON=0;  //Timer Stops

  a = (TMR1L | (TMR1H<<8));  //Reads Timer Value
  a = a/58;  //Converts Time to Distance
  a = a + 1;  //Distance Calibration
  if(a>=2 && a<=400)  //Check whether the result is valid or not
  {
  RB5=1;
  }
  else
  {
  RB5=0;
  }
  __delay_ms(400);
  }
}
 
So re-cap

Pic16f72.... Running( supposedly) at 20Mhz... You are setting the ports to output .. ie.. "0" but there is no output and the ports appear as floating!!!

1) The pic isn't running... OSC issues or MCLR not set correctly.
2) The pic IS running..... Internal damage..
3) Hardware limitations..... Not enough current... dry solder joint....

Hi,
I think point 2 is right because Today i tested this PIc in another working board exchanged it with different it was not working at all so, PIC KIt 2 is reading but there is unknown internal damage don't know what is that.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top