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 CCS Technical Support

18F87K22 INT0 firing random.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
beaker404



Joined: 24 Jul 2012
Posts: 163

View user's profile Send private message

18F87K22 INT0 firing random.
PostPosted: Fri May 10, 2019 9:48 am     Reply with quote

Throwing this out to the group. Not really a programming question, but perhaps it is if it is fuse disable issue.

I am using INT0 on PIN_B0 as a trigger for firing off my ACQ loop section. Pretty standard stuff, and I have done it allot on 16F876 platforms. Trigger circuit is simple, interrupt line is pulled up with a 10K resistor to 5VDC. Same 5VDC used to power the PIC. INT0 line is grounded to trip the interrupt.
It will trip every once in a while by itself and the scope shows a sharp dip to ground then a typical rise curve back to 5V. I thought it was my switch, but do not have anything connected external to the PCB and it still does it. Anyone got thoughts on this? Is it a fuse that is not set right? here is some code snippets.

Code:
#device PIC18f87k22
#include <18F87K22.h>
#device ADC=12
#fuses HSH, NOWDT, PUT, NOBROWNOUT, NOMCLR
#use delay(crystal=15M, clock=60M)
#use rs232(UART1, baud=57600, STREAM=SERIAL, errors)
#USE SPI(MASTER, MODE=0, SPI1, STREAM=SPI,FORCE_HW)


Code:
void init_hardware() {
// Initializes all hardware.

    setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
    set_timer1(64845L);                                  // 20KHz rollover rate
    enable_interrupts(INT_TIMER1);
   output_high(SRAM_CS1);
   output_high(SRAM_CS2);
   output_high(SRAM_CS3);                                // SRAM and EEPROM Select lines
   output_high(EEPROM_CS);

   output_low(LED_BLINK);
   output_high(SRAM_HOLD);
   setup_adc(ADC_CLOCK_DIV_32);          // set up ADC
   setup_adc_ports(sAN0|VSS_VDD);                        // only AN0 is analog port with range of 0 - 5VDC

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

}  // end init_hardware()


I really hate to put allot of capacitance on this line as my trigger needs to be fast.

18F87K22 running 60MHz
CCS 5.064
MPLAB 8.91
Windows 10
beaker404



Joined: 24 Jul 2012
Posts: 163

View user's profile Send private message

PostPosted: Fri May 10, 2019 10:13 am     Reply with quote

one other bit of information, I am powering my board off of the PICKIT3 at 5V
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 10, 2019 10:33 am     Reply with quote

Pickit 3 manual says:
Quote:

3.4.4 Powering the Target

These are configuration essentials:

• When using the USB connection, PICkit 3 can be powered from the PC
but it can only provide a limited amount of current, up to 30 mA, at
VDD from 1.8-5V to a small target board.

The desired method is for the target to provide VDD since it can
provide a higher current. The additional benefit is that plug-and-play
target detection facility is inherited, i.e., MPLAB IDE will let you know in
the Output window when it has detected the target and has detected the device.


Get an external power supply for your board, and also, set all unused i/o
pins to a logic low level. This will reduce noise injected into the PIC
through floating i/o pins.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Fri May 10, 2019 12:22 pm     Reply with quote

and remember at 60MHz, the pulse needed to trigger the interrupt will
be shorter than on the older PIC, and at that speed the load on the
PicKit will be higher than it is designed to deliver.
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