Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help wanted -PIC integrated with a MAXQ3180

Status
Not open for further replies.

Ram Prasadh

Member level 2
Joined
Feb 16, 2011
Messages
51
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,725
Hi

I have Presently started working on a device which will be useful for Power Measurement. I am using a PIC16F72 Controller with a MAX3180. I use a 4 Mhz Oscillator for the PIC. I wrote a code to just toggle the bits of port b in the PIC , but when I burn the hex code ,it is not even making any changes in the port. I am attaching that code here. I have a doubt on the operation of the Oscillator.Please give me some suggestion on where the problem could be?





#include<pic16f72.h>
typedef unsigned int word;
word at 0x2007 CONFIG = _HS_OSC & _WDT_OFF & _PWRTE_OFF & _CP_OFF & _BODEN_ON;

void delay()
{
unsigned int z;
for(z=0;z<250;z++);
}
void main(void)
{
TRISB=0;
for(;;)
{
while(1)
{
PORTB=0X00;
delay();
PORTB=0XFF;
delay();
}
}
}
 

The code should work. You do however have two loops, one inside the other which is not necessary. Putting code in a "for(;;) { }" loop makes it loop forever, within that loop you also have a "while(1) { }" which does the same thing.

The config setting suggests you are using an external crystal or resonator, do you have loading capacitors (approx 22pF) from each side of the crystal to ground and do you have a decoupling capacitor (approx 100nF) directly across the VSS and VDD pins? Without both of these the internal oscillator may not run. Do you also have a resistor (suggest 10K) between MCLR and VDD to prevent the PIC going into a reset state?

How are you checking for PORTB pins changing state? Depending on the crystal frequency you are using, the speed could be very high, possibly hundreds of KHz.

Brian.
 
Hi Brian,
Thanks for your help. I will Check the Circuit and will reply, if some sort of changes is done. Thank You very much
 

Hi Brian

I have attached the schematic for my board. I have used a 4Mhz Crystal instead of a 12 Mhz Crystal as given in the Schematic. Looking forward for your suggestions .

Ram Prasadh
 

Attachments

  • SCHEMATIC1 _ PAGE1.pdf
    13.4 KB · Views: 82

You absolutely MUST add a capacitor (suggest 100nF) between VSS and VDD and it should be wired as close as possible to the pins.
At 4MHz it should work but check the data sheets if you try to run it at 3.3V and 12MHz, there is a top speed limit as the supply voltage is dropped below 4V.

The software should work though, what are you using to program the IC? Can you read it back and make sure the config fuses have programmed correctly.

Brian.
 
Its working !! Its working!!! Thank you very much for your help. Had a Problem with the capacitor as you said.Starting to study on how to integrate and work with an MAXQ3180.Will contact you if I face any Problem.

Ram Prasadh
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top