|
|
View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Sep 21, 2004 5:45 pm |
|
|
Quote: | When its connected to PIN_B3 it doesnt read the high at all and does not update until the PIN goes low again. |
This sounds like the pin is configured for LVP mode.
I looked at the eetools.com download page.
http://www.eetools.com/download.asp
The latest update for the Chipmax was in December 2002.
That's not good. It means they don't fix bugs, and there are
always going to be some. I suspect they are not programming
the LVP fuse properly. (ie., you can't disable LVP mode).
Assuming you can't get another programmer, my suggestion is to put
a 10K pull-down resistor (to ground) on Pin B3, and don't use that pin.
Then use Pin B4. It should work. As long as pin B3 is pulled down
to ground, then the PIC will not go into LVP mode. (ie., it won't lock up).
To test if you can make pin B4 work as an input, try this simple test
program. It reads pin B4 continuously, and outputs the value it read
onto pin B0. So if you had a push-button on Pin B4, and a LED on
Pin B0, then when you press the button the LED should turn on.
(or go off, depending on how you have the LED wired).
If you have an oscilloscope you can leave off the LED and just look
at pin B0 to see if it follows pin B4. Note that I have port B pullups
turned on, so the idle state for pin B4 is a high level. When the
pushbutton is pressed, pin B4 will go to ground. (One side of my
pushbutton is connected to pin B4, and the other side to ground).
Code: |
#include <16F819.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT
#use delay(clock = 4000000)
//==================
void main()
{
char value;
port_b_pullups(TRUE);
while(1)
{
value = input(PIN_B4);
output_bit(PIN_B0, value);
}
while(1);
} |
|
|
|
BMaxwell
Joined: 07 May 2004 Posts: 20
|
ROFL - Im an idiot |
Posted: Wed Sep 22, 2004 12:33 pm |
|
|
Try this line and dont laugh to much PCM. if(input(PIN_B3==1))
ROFL suppose to be if(input(PIN_B3)==1) woops. No wonder it hanged. Lol talk about a mistake. Anyways thanks for the help, you are the man.
Bryan |
|
|
Suma Guest
|
I don't get it |
Posted: Thu Mar 02, 2006 4:27 am |
|
|
From 1 week ago I have a IDC2 to program my PIC, 16f819.
I have never used a PIC before, and I have some knowledge in rpogramming with C.
This is my last program, I am trying to make flash one pin of the PIC, but I don't understand why it doesn't work.
Maybe you can give me a hand. If you know where I could find easy examples, etc.
This is my program:
Code: |
#include "E:\Documents and ..\pogramas C compiler\prueba3\prueba3.h"
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
void main() {
port_b_pullups(TRUE);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,WDT_18MS);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
while(true){
output_high(PIN_A1); //se activa el pin
delay_ms(1000); //esperamos un segundo
output_low(PIN_A1); //lo bajamos
delay_ms(1000); //esperamos otro poquito
}
}
|
And this my .h:
Code: |
#include <16F819.h>
#device adc=8
#use delay(clock=4000000)
#fuses INTRC_IO,PUT,WDT
|
Thanks you for helping me. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 02, 2006 1:01 pm |
|
|
Change the prueba3.h file to this:
Code: | #include <16F819.h>
#device adc=8
#fuses INTRC_IO, PUT, NOWDT, NOLVP
#use delay(clock=4000000)
|
Notice the following things about the code above:
1. The Watchdog Timer is disabled by using NOWDT.
2. Low Voltage Programming mode is disabled by using NOLVP.
3. Also notice that I have put the #use delay() statement below
the #fuses statement. The order of the statements is important.
When it's done in the order above, the compiler will insert code to
setup the oscillator properly for INTRC_IO and 4 MHz operation. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|