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

TIMER1 & TIMER3 won't interrupt
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Sun Jan 14, 2024 1:51 am     Reply with quote

Hi Ttelmah

Thank you for the answer

Just for me to learn and understand:
If I am writing NOWDT in the fuses it is not disabling the WDT?
If in the LST is written NOWDT doesn't mean WDT disabled?
Also in MPLAB 8.92, Configuration bits is written:
Whatch dog timer is always disabled. SWDTEN has no effect.
I am confused Sad

Best wishes
Joe
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sun Jan 14, 2024 4:19 am     Reply with quote

What was posted as the test program on Fri 12th Jan, did not have NO_WDT
in it when it was posted. It had:
Code:

/////////////////////////////////////////////////////////////////////
//TEST26K22
/////////////////////////////////////////////////////////////////////
#include <18F26K22.h>
#device ADC=10
#FUSES WDT//Watch Dog Timer enabled; WDT period is 4ms
#FUSES WDT4//Watch Dog Timer uses 1:4 Postscale;interrupts every 16ms                                         
#FUSES NOPBADEN//PORTB pins are configured as digital I/O on RESET
#FUSES PUT//Power Up Timer enabled
#FUSES BROWNOUT//Reset when brownout detect enabled
#FUSES BORV29//Brownout reset at 2.9V
#FUSES HSH//High speed Osc, high power 16MHz-25MHz
#FUSES PLLEN//4X HW PLL enabled
#FUSES NOIESO//Internal External Switch Over mode disabled
#FUSES NOFCMEN//Fail-safe clock monitor disabled
#FUSES NOHFOFST//High Frequency INTRC waits until stable before clocking CPU
#FUSES MCLR//Master Clear pin enabled
#FUSES STVREN//Stack full/underflow will cause reset
#FUSES NOLVP// No low voltage progming
#FUSES NOXINST//Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NODEBUG//No Debug mode for ICD
#FUSES NOPROTECT//Code not protected from reading
#FUSES NOCPD//No EE protection
#FUSES NOWRT//Program memory not write protected
#FUSES NOWRTC//configuration registers not write protected
#FUSES NOWRTD//Data EEPROM not write protected
#use delay(clock=64MHz,crystal=16MHz)
#use rs232(baud=9600, UART1, stream=PORT1, errors)//communication with the PC
#use rs232(baud=9600, UART2, stream=PORT2, errors)
//#use I2C(MASTER, FAST=400000, I2C1, STREAM=I2CPORT)//I2C1 hardware used
#device HIGH_INTS=TRUE


It had the WDT fuses still there as posted.
What I post above was directly cut and pasted from this at the time.

This was changed a little later, but not before I had taken this to test.

Have you compared what the 5.061 generates to what you have when
compiling the posted source?.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Sun Jan 14, 2024 5:13 am     Reply with quote

Hi Ttelmah

Thank you for the answer

On Thu Jan 11, 2024 10:33 pm I have posted the program //TEST26K22
with WDT enabled.
After your remarks and Temtronic remarks I have posted
on Fri 12th Jan, 2024 8:29 pm the program //TEST26K22V1
with WDT disabled

Best wishes
Joe
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sun Jan 14, 2024 12:40 pm     Reply with quote

Beg to differ.

Your original post with the note:

Quote:

Made new program per your advice, TIMER1 still won't interrupt


Had the WDT still enabled. At some point afterwards this was changed to
have the WDT disabled.

It was the code in this program I downloaded to test.

Your original code was controlling multiple timers. This later code only
one.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jan 14, 2024 1:09 pm     Reply with quote

comment.
When making changes, I usually copy the existing version,make changes, save as filenamevnnn.c, compile and test. 'nnn' goes up as the 'version' goes up...

Yes, I can have 20-30-100 versions of the program BUT I can go ALWAYS go back to a previous version. V001 is always the '1Hz LED base program'.

It's too easy to make a couple changes and oh while I'm here, edit this or that, and it doesn't work..then get confused as to WHAT change should I NOT have made.

I also try to add comments at the end of most lines of code. Cost nothing in programming space, just time to press keys....
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Sun Jan 14, 2024 8:20 pm     Reply with quote

Any how, thank you all for the help

Wish you all a nice week
Joe
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Mon Jan 15, 2024 6:02 am     Reply with quote

I have to ask an enormously important question?.
How are you testing this?????.

Reason I ask, is I had the test code running in a chip on a breadboard,
and working fine. Just thought I'd try a couple of things to see what might
be happening, so tried it the in MPLAB 8.92 simulator. Guess what. It does
what you are describing. Timer0 runs fine Timer1, does not.
I think what you have is a fault with this simulator, when handling the
gated timers. Not with the code.... Sad
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Mon Jan 15, 2024 6:22 am     Reply with quote

Hi Ttelmah

I just tried the program on the PCB itself (just got them) and TIMER1 interrupt working
TIMER1 & TIMER3 don't work in the simulator with PIC18F26K22
By the way, TIMER1 works in the simulator with PIC16F1847

Tried also on the new PCB a much more complex program with many functions and TIMER1 & TIMER3 works correct.

Thank you for the help

Best wishes
Joe
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Mon Jan 15, 2024 7:43 am     Reply with quote

You originally said "I tested on my PCB". which is why this wasn't spotted
much earlier..... Sad

I remember there being problems with the gated timers on a number of
PIC's with the simulator a long time ago.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 15, 2024 8:11 am     Reply with quote

re: TIMER1 & TIMER3 don't work in the simulator with PIC18F26K22

arrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrgh

'simulator'

arrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrgh....
sorry but I live and work in the real world and after almost 3 decades of 'playing with PICs' have never ever found a 'simulator' that ACTUALLY works.
OK, my rants over...though it's -17*C here,
brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Mon Jan 15, 2024 8:34 am     Reply with quote

Hi Ttelmah, Temtronic and Gaugeguy

Sorry spending your time on the topic.
Please accept my appology.

Best wishes
Joe
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 15, 2024 8:46 am     Reply with quote

As you've found out,over the past few days, it's really important to say 'real PIC' or 'simulated'.

As I'm a 'dinosaur', I always assume a real PIC, maybe even wirewrapped on on a 'white board'. I also prefer DIP PICs as I can just see those pins( 70 year old eyes). SMT soldering is not an option.
good news is the REASON has been found as to why 'it doesn't work' !!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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