CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

16f628 newbie problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
|Xne.3



Joined: 16 Dec 2004
Posts: 1

View user's profile Send private message

16f628 newbie problem
PostPosted: Thu Dec 16, 2004 3:17 am     Reply with quote

hello, i am new in the pic bussines and i have a problem. i use the 16f628a with an internal clock, a switch with an 10kohm resistant(pull down) on the RB0 - EXT_INT and a transistor to switch on a led.

the problem is that the systems works perfect when i pull my finger on the chip and it doesn't work when i give my hand away.

here is the source:

#include <16F628.h>
#use delay(clock=4000000)
#fuses INTRC_IO,NOWDT

#EXT_INT
void isr(){
output_high(PIN_B3);
delay_ms(500);



}


void main() {
ext_int_edge(H_TO_L); // init interrupt triggering for button press
enable_interrupts(INT_EXT);// turn on interrupts
enable_interrupts(GLOBAL);

set_tris_a(0);
set_tris_b(0b00000001); // RB0 wird als Eingang definiert



while (1)
{
delay_ms(500);
output_low(PIN_B3); //LED wird auf LOW gesetzt
delay_ms(500);
output_high(PIN_B3);

}
}


simple, but it doesn't work.


thanks for help!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 16, 2004 2:00 pm     Reply with quote

Quote:
The problem is that the systems works perfect when i pull my finger on the chip and it doesn't work when i give my hand away.


Two possible solutions:
1. Add NOLVP to the end of the #fuses statement.

2. Make sure that the MCLR pin is connected to your Vdd voltage
(probably +5v in your case) through a resistor. The resistor
value could be 10K, but if you are using the CCS ICD, then it
should be 47K.
Guest








PostPosted: Thu Dec 16, 2004 6:58 pm     Reply with quote

make sure your switch is held high and grounds when button pressed. i had a similar problem with a pic because i was letting the pins float and they would go high when a hand was waved near the circuit.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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