INTERRUPTS in Oshonsoft basic

Thread Starter

camerart

Joined Feb 25, 2013
3,724
Hi,
Looking at the INTERRUPT routine examples in the Oshonsoft help files, it shows an option to use ON INTERRUPT, but this shows and error, which clears if ON HIGH INTERRUPT is used instead.

Does any one know why this is?
Camerart
 

ericgibbs

Joined Jan 29, 2010
18,766
hi C,
Do you have a Code example to post.?
E

Edit:
Are you enabling High or Low Interrupts?

Using interrupts
Enable High,Enable Low,Disable High,Disable Low,On High Interrupt,On Low Interrupt,Resume,Save System,
Interrupt routines (high and low priority) should be placed as all other subroutines after the END statement. They should begin with ON LOW INTERRUPT or ON HIGH INTERRUPT statement and end with RESUME statement. If arithmetic operations, arrays or any other complex statements are used in interrupt routine, then SAVE SYSTEM statement should be placed right after ON LOW/HIGH INTERRUPT statement to save the content of registers used by system. ENABLE LOW, ENABLE HIGH, DISABLE LOW and DISABLE HIGH statements can be used in main program to control GIEH and GIEL bits in INTCON register. RESUME statement will set the appropriate GIEH or GIEL bit and enable new interrupts. For example:
Example 1:
Dim x As Byte
x = 255
TRISA = 0
PORTA = x
INTCON.INT0IE = 1
Enable High
End

On High Interrupt
x = x - 1
PORTA = x
INTCON.INT0IF = 0
Resume
 

jjw

Joined Dec 24, 2013
823
Hi E,
I normally use ON HIGH INTERRUPT, and there's no problem, but was advised to keep it simple and use ON INTERRUPT.

We must be looking at an old help version?
C
You should look at the manual in the Basic compiler window.
The manual in the Oshonsoft home page is more or less generic.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
hi C,
Do you understand the purpose of High and Low interrupts.?

E
link.
https://openlabpro.com/guide/interrupt-handling-in-pic18f4550/
Hi E and J,
I kind of understand how Interrupts work, but as the CODE is HW, I wonder if we're mixing HW with SW?
I presume that ON HIGH INTERRUPT is OSH SW, but there are settings in the 18F4431 D/S that also switch INTERRUPTs high or low priority.
Also I was told that in this case, Interrupt level is not needed, even though there will be 2x interrupts.
So not really clear!
I can't post the CODE as it is being edited daily.
C
 

jjw

Joined Dec 24, 2013
823
But the Oshonsoft Basic statements for PIC18F controllers interrupts are either
On high Interrupt
or
On low Interrupt
no statement for On Interrupt
It is on the programmer how to use them
 

djsfantasi

Joined Apr 11, 2010
9,156
C,
In many of your posts you differentiate between HW and SW methods. I’d like to understand what YOU think is the difference? It would help in responding to your questions.
I kind of understand how Interrupts work, but as the CODE is HW, I wonder if we're mixing HW with SW?
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
C,
In many of your posts you differentiate between HW and SW methods. I’d like to understand what YOU think is the difference? It would help in responding to your questions.
Hi J, D and E,
It's taken me a long time to understand mostly what SW and HW is.
What's confusing is mixing. (correct anything I write)
e,g, We write SW to talk to HW, I use Oshonsoft which is SW, and write to HW.

A PIC has HW modules e,g timer module built inside it. This would be set using the D/S to set the Enable BITs, flags etc.

In Oshonsoft is ON HIGH INTERRUPT, but in the D/S there is 'attached':
C.
 

Attachments

djsfantasi

Joined Apr 11, 2010
9,156
Hi J, D and E,
It's taken me a long time to understand mostly what SW and HW is.
What's confusing is mixing. (correct anything I write)
e,g, We write SW to talk to HW, I use Oshonsoft which is SW, and write to HW.

A PIC has HW modules e,g timer module built inside it. This would be set using the D/S to set the Enable BITs, flags etc.

In Oshonsoft is ON HIGH INTERRUPT, but in the D/S there is 'attached':
C.
I guess I have a different perspective. Software (SW) is always necessary to communicate to hardware (HW). One needs to use appropriate software in order to perform this communication successfully.

So I do not see the difference other than understanding what the hardware requires from the software. In fact, I believe that your perception of a difference leads to your difficulties in controlling devices.

Imagine two automobiles. One has a manual transmission; one has an automatic transmission. Both shift gears while driving, but you use different skills. You are the software. The transmission is the hardware. You need to understand the different skills required to drive the automobile.

Just like you need to understand the different coding techniques to drive your devices. However in the microprocessor and coding language scenario, you might have the option to use multiple approaches. And you get the option of choosing the easiest technique based on your understanding.

But! Hardware and software approaches are not mutually exclusive in some cases.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,724
I guess I have a different perspective. Software (SW) is always necessary to communicate to hardware (HW). One needs to use appropriate software in order to perform this communication successfully.

So I do not see the difference other than understanding what the hardware requires from the software. In fact, I believe that your perception of a difference leads to your difficulties in controlling devices.

Imagine two automobiles. One has a manual transmission; one has an automatic transmission. Both shift gears while driving, but you use different skills. You are the software. The transmission is the hardware. You need to understand the different skills required to drive the automobile.

Just like you need to understand the different coding techniques to drive your devices. However in the microprocessor and coding language scenario, you might have the option to use multiple approaches. And you get the option of choosing the easiest technique based on your understanding.

But! Hardware and software approaches are not mutually exclusive in some cases.
Hi D,
Mayben you can see my difficulities! Your reply hasn't clarified anything to me.
It's a kid of Dyslexia thing, that I hope you don't mind putting up with.
I'm frustratingly used to it, and simply carry on, till I get results.
Thanks C.
 

ericgibbs

Joined Jan 29, 2010
18,766
It's taken me a long time to understand mostly what SW and HW is.
What's confusing is mixing. (correct anything I write)
e,g, We write SW to talk to HW, I use Oshonsoft which is SW, and write to HW.

A PIC has HW modules e,g timer module built inside it. This would be set using the D/S to set the Enable BITs, flags etc.
hi C,
When you write in your program Code for example Enable High and Enable Low the Basic Compiler writes a block of Machine Code which sets bits in the GIEH or GIEL in the INTCON, register.

You can double-check the *.lst file the Compiler creates, in Assembly

Added a clip from the *.lst file
0453 000144 ; 175: Enable High 'ADDED from INCLUDE &
0454 000144 8EF2 BSF INTCON,GIEH
0455 000146 ; 176: Enable Low 'ADDED from INCLUDE &
0456 000146 8CF2 BSF INTCON,GIEL
0457 000148 ; 177:
-------------------------

So when writing your program Code you can use either Enable High or Enable Low
or
Set the Bits directly in the INTC0N GIEH or INTCON GIEL

E


Using interrupts -------------------------------------
Enable High
Enable Low
Disable High
Disable Low
On High Interrupt
On Low Interrupt,
Resume,
Save System,

Interrupt routines (high and low priority) should be placed as all other subroutines after the END statement.
They should begin with ON LOW INTERRUPT or ON HIGH INTERRUPT statement
and end with RESUME statement. If arithmetic operations,
arrays or any other complex statements are used in interrupt routine,
then SAVE SYSTEM statement should be placed right after ON LOW/HIGH INTERRUPT statement
to save the content of registers used by system.
ENABLE LOW,
ENABLE HIGH,
DISABLE LOW and DISABLE HIGH statements
can be used in main program to control GIEH and GIEL bits in INTCON register.
RESUME statement will set the appropriate GIEH or GIEL bit and enable new interrupts
.
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,724
hi C,
When you write in your program Code for example Enable High and Enable Low the Basic Compiler writes a block of Machine Code which sets bits in the GIEH or GIEL in the INTCON, register.

You can double-check the *.lst file the Compiler creates, in Assembly

Added a clip from the *.lst file
0453 000144 ; 175: Enable High 'ADDED from INCLUDE &
0454 000144 8EF2 BSF INTCON,GIEH
0455 000146 ; 176: Enable Low 'ADDED from INCLUDE &
0456 000146 8CF2 BSF INTCON,GIEL
0457 000148 ; 177:
-------------------------

So when writing your program Code you can use either Enable High or Enable Low
or
Set the Bits directly in the INTC0N GIEH or INTCON GIEL

E


Using interrupts -------------------------------------
Enable High
Enable Low
Disable High
Disable Low
On High Interrupt
On Low Interrupt,
Resume,
Save System,

Interrupt routines (high and low priority) should be placed as all other subroutines after the END statement.
They should begin with ON LOW INTERRUPT or ON HIGH INTERRUPT statement
and end with RESUME statement. If arithmetic operations,
arrays or any other complex statements are used in interrupt routine,
then SAVE SYSTEM statement should be placed right after ON LOW/HIGH INTERRUPT statement
to save the content of registers used by system.
ENABLE LOW,
ENABLE HIGH,
DISABLE LOW and DISABLE HIGH statements
can be used in main program to control GIEH and GIEL bits in INTCON register.
RESUME statement will set the appropriate GIEH or GIEL bit and enable new interrupts
.
Hi E,
The clouds are passing over!
We (The CODe author) and I have been using both methods together, and were getting mixed up. I tried a test, where the GIE, RCON etc are used and commented out the ON HIGH INTERRUPT and RESUME lines, and it still worked, which was puzzling, but it was INTERRUPTING.
Today he's tried using PIR1.CCP1IF, CCP1CON, CCPR1 from the D/S, and no OHI +R.
We're still working on it, and I'm trying to keep up :)
Thanks.
C
 
Top