|
|
View previous topic :: View next topic |
Author |
Message |
drolleman Guest
|
628 can't make a3,a4 output |
Posted: Fri Mar 12, 2004 2:10 pm |
|
|
I can't make the 628 output on a3 and a 4. i created a minimum progran to test for output. but nothing i try works. can anyone help?
#include <16f628.h>
#fuses intrc,WDT,PROTECT,NOBROWNOUT,PUT,NOLVP,NOCPD
#use delay(clock=4000000)
//#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1,enable=pin_a0) // Jumpers: 8
//#use fixed_io(a_outputs=pin_a0, pin_a1, pin_a2, pin_a3, pin_a4)
//#use fixed_io(a_outputs=pin_a0, pin_a1, pin_a2, pin_a3, pin_a4)
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
///////////////////// MAIN ///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
main()
{
//set_tris_b(0x00);
set_tris_a(0x00);
//setup_ccp1(ccp_off);
//setup_comparator(a0_a3_a1_a2);
//output_low(PIN_A0);
output_high(PIN_A3);
output_high(PIN_A4);
// for setting the calibration of the rev limiter
//ground the pin on start then within 5 sec then release
// this puts the chip into calibration mode
while(1)
{
output_high(PIN_A0);
output_high(PIN_A1);
output_high(PIN_A2);
output_high(PIN_A3);
output_high(PIN_A4);
delay_ms(500);
output_low(PIN_A0);
output_low(PIN_A1);
output_low(PIN_A2);
output_low(PIN_A3);
output_low(PIN_A4);
delay_ms(500);
}
return 0;
} |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
RA3/RA4 |
Posted: Fri Mar 12, 2004 2:28 pm |
|
|
According to the 16F628 data sheet RA4/AN4 is open collector
so you will need a pullup resistor there.
Try adding the line:
setup_comparator(NC_NC_NC_NC);
To make sure the the comparators are turned off and the pins are in digital mode. |
|
|
drolleman Guest
|
|
Posted: Fri Mar 12, 2004 3:40 pm |
|
|
that fixed a4 but a3 still doesn't work i know the output works because when the device wasn't programed the led that is connected to the pin was on. I added the nc on the comparater that was sugessted. is there somthing else i need to do? |
|
|
asjad
Joined: 09 Mar 2004 Posts: 52 Location: Greater Manchester - UK
|
analog pins |
Posted: Fri Mar 12, 2004 4:27 pm |
|
|
Hi,
I have looked at the datasheet and it seems that when ever your
pic and most pics are powerd up PORTA is not configured as
digital Input/Output
Look at the top right of page 31 of the datasheet.
To cure this you need to look at the A/D convertor commands.
one of the commands will set diffrent pins on port A to digital. _________________ Best Regards |
|
|
drolleman Guest
|
|
Posted: Fri Mar 12, 2004 5:47 pm |
|
|
the 628 doesn't have a/d convereter. |
|
|
Ttelmah Guest
|
|
Posted: Sat Mar 13, 2004 9:04 am |
|
|
drolleman wrote: | the 628 doesn't have a/d convereter. |
Try adding 'SETUP_CCP(CCP_OFF);'.
A3, is multiplexed to the comparator (as you have allready found), and to the CCP. It may be waking up you this enabled.
Best Wishes |
|
|
|
|
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
|