BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Thu Apr 26, 2018 2:46 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Interrupts on the Nano8 (and Nano18)
PostPosted: Sun Jan 17, 2016 3:52 pm 
Offline
Guru

Joined: Fri Dec 07, 2012 3:48 pm
Posts: 67
I had a problem getting Interrupts working on the Nano8 until Dave supplied a solution, although it does not explain the problem:

• Weird, but this (Reserved Words) DOES NOT WORK on the Nano8 for any Interrupt
TMR1IE = 1 ; Enable TMR1 Interrupt
GIE = 1 ; Enable Global Interrupt
PEIE = 1 ; Enable Peripheral Interrupt

• But this works on both the Nano8 and Nano18
PIE1 = %00000001 ; Enable TMR1 Interrupt
INTCON = %11000000 ; Enable Global Interrupt & Peripheral Interrupt

• This also works on both the Nano8 and Nano18
T1CON.BIT0 = 1 ; Enable TMR1 : TMR1ON = 1
PIE1.BIT0 = 1 ; Enable TMR1 Interrupt : TMR1IE = 1
INTCON.BIT7 = 1 ; Enable Global Interrupt
INTCON.BIT6 = 1 ; Enable Peripheral Interrupt

I have re-checked the Register and Bit Addresses in the BASICATOM08NANO.inc and the PBASICATOM08NANO.inc files and everything is correct, yet using the Reserved Words as above do not work on the Nano8? Perhaps something odd in the Compiler?

The same problem exists on the Nano8 when using an Edge-Triggered Interrupt.

I have also found that using an Interrupt on the Nano8 destroys any SEROUT output. No problem on a Nano18x, though.
In any case, I have spent the day testing all manner of Interrupt programs on the Nano8 and Nano18x and have attached the programs. They are copiously commented.

I have not tested Interrupts on the Nano28, but according to the Microchip Datasheets, the applicable Nano18 and Nano28 Special Function Registers seem to be the same.

I have also attached a small Excel Spreadsheet for calculating Timer1 Delays.

All programs and spreadsheet are in the zip file.

Have fun.

Regards
Andre

PS. Dave, uploading of a .xlsx attachment has stopped working again ?


Attachments:
Nano Interrupts.zip [17.7 KiB]
Downloaded 97 times
Top
 Profile  
 
 Post subject: Re: Interrupts on the Nano8 (and Nano18)
PostPosted: Sun Jan 17, 2016 7:00 pm 
Offline
Guru

Joined: Fri Dec 07, 2012 3:48 pm
Posts: 67
Apologies, but it seems like I am not allowed to edit my original post - odd.

I have made some cosmetic and legibility changes to the previously attached programs. Attached in an updated zip file.

And something which I wrote up for myself (btfss, btfsc, skpnz & skpz.bas) because I am not Assembler-Friendly. Refer to the program which toggles an LED from within israsm.

Regards
Andre


Attachments:
BTFSS, BTFSC, SKPNZ & SKPZ.bas [1.98 KiB]
Downloaded 306 times
UPDATED - Nano Interrupts.zip [18.16 KiB]
Downloaded 95 times
Top
 Profile  
 
 Post subject: Re: Interrupts on the Nano8 (and Nano18)
PostPosted: Mon Jan 18, 2016 7:43 am 
Offline
Guru

Joined: Fri Dec 07, 2012 3:48 pm
Posts: 67
OK, I have tested all the attached programs on a Nano28x and they work fine :D

So the Nano18 and Nano28 Timer1 and Edge Interrupts work with the same program and israsm code.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO