View previous topic :: View next topic |
Author |
Message |
Alexander-Dan
Joined: 13 Mar 2014 Posts: 111 Location: S.Posad
|
Posted: Fri Apr 27, 2018 6:48 pm Post subject: collision: Int UART and DMX-512 |
|
|
hi!
I have a collision when using two commands that work with interrupting uart when I get a new character into the buffer.
I understand that using the DMX library commands organizes a buffer in the AVR's memory to accept the symbols from the uart. For this a hardware interrupt is used.
but how do I turn off the DMX mode and its buffer in order to use uart in another mode?
From the point of view of the algorithm and the operation of the microcontroller, I have the right to use different uart settings in different modes.
How do I turn off compiler checking?
What for in the compiler such check is done?
Error : 249 Line : 26 ISR already defined [UART_INT] , in File : D:\!!!_my\DMX-512\123.bas
Code: |
$regfile = "m32adef.dat" '
$crystal = 8000000
$hwstack = 64 '
$swstack = 64 '
$framesize = 64
Dim Temp As Byte , Dmx_start As Word
Config Portb.3 = Input : Portb.3 = 1
Sw_mode Alias Pinb.3 ' Radio or DMX-512
If Sw_mode = 1 Then ' DMX-512
Config Dmxslave = Com1 , Channels = 5 , Dmxstart = 1 , Store = 5
Enable Interrupts
_dmx_address = 1
Else ' Radio
Baud = 2400
On Urxc Uart_int
Enable Urxc
Enable Interrupts
End If
Uart_int: '---------------------------------
Inputbin Temp
Return
|
(BASCOM-AVR version : 2.0.8.1 ) |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Fri Apr 27, 2018 8:38 pm Post subject: |
|
|
I think you must resolve DMX and Radio in your way with your code for receiveing bytes.
I dont konw everytging but I know this:
Every Interrupt have its own Interrupt vector ->place where uC should jump after firing Interrupt.
Bascom for every Interrupt that you not declare "On Interrupt Xxx Jump_here" insert safe code "RETI"
It means that if you "EANBLE ACI" - that means "Enable Interrupt when comparator change" and not declare "On ACI Aci_interrupt" then when processor check that interrupt from ACI must be servised then it jumps to the Interrupt Vector and read "RETI"
This brings the second conclusion. If Label where uC should Jump after firing URXC is once declared then it should be only one...
So you should modify routine for DMX receive or....
I advise to use some processor with two USARTs like '4 means 644P and simillar
There is more uC with two Usarts like 162 (I gues now) |
|
Back to top |
|
|
Alexander-Dan
Joined: 13 Mar 2014 Posts: 111 Location: S.Posad
|
Posted: Fri Apr 27, 2018 8:49 pm Post subject: |
|
|
Thanks you, EDC
I know it's, but I can write code in any other language for this microcontroller and it will work very good
The programmer has the ability to install any vector while the program is running.
I do not understand why it was forbidden to the compiler to use several options for setting the port.
I can write the DMX reception myself, but I'd really like to write on Bascom, and not mix Bascom and assembler. |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Apr 27, 2018 9:00 pm Post subject: Re: collision: Int UART and DMX-512 |
|
|
Alexander-Dan wrote: | From the point of view of the algorithm and the operation of the microcontroller, I have the right to use different uart settings in different modes. |
You have the right to use different UART settings, but you don't have the right to alter the interrupt vector itself, as it is hardwired into flash.
However you can (if you can ) hook the vector at its target address, which is _DMXREC: in mcs.lib, and redirect it to your desired label in user code.
A clean way would be not to alter mcs.lib, instead copy everything belonging to [_DMXREC], paste it into a lib named however you want, alter this lib and include it via $LIB ... into your code.
For altering the [_DMXREC]-code, you should know how to write some assembler code for the hook.
Quote: | The programmer has the ability to install any vector while the program is running. |
So you do not know much about AVRs.
You can not alter the vector itself, I wrote that already.
Quote: | I can write the DMX reception myself, but I'd really like to write on Bascom, and not mix Bascom and assembler. |
Seems you're lost then. |
|
Back to top |
|
|
Alexander-Dan
Joined: 13 Mar 2014 Posts: 111 Location: S.Posad
|
Posted: Fri Apr 27, 2018 9:10 pm Post subject: Re: collision: Int UART and DMX-512 |
|
|
I do not speak English, I just read. it's hard for me to explain it to you.
I can change the vector data. Load my value into the interrupt table. |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Fri Apr 27, 2018 9:21 pm Post subject: |
|
|
You re not born yesterday. So when some Bascom "Hi level function" uses Timer0 and you want to use it too then you must have some ASM skills or simply use another Timer.
If you can do this with another language then why dont you read generated asm code and use portion of it?
I think you take this case from the wrong way |
|
Back to top |
|
|
Alexander-Dan
Joined: 13 Mar 2014 Posts: 111 Location: S.Posad
|
Posted: Fri Apr 27, 2018 9:28 pm Post subject: |
|
|
eh. I will be forced to use assembler.
This is the first time in many years using Bascom ... |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Fri Apr 27, 2018 9:32 pm Post subject: Re: collision: Int UART and DMX-512 |
|
|
Alexander-Dan wrote: | I can change the vector data. Load my value into the interrupt table. |
It's no matter of Englisch, it's a matter of how these AVRs work.
You can write the flash at programming time and the IVT is part of flash.
Rewriting the IVT to different target addresses can be done again - at next time you program the chip.
What you want to do is to change the vector at runtime, which is not possible.
What's possible is to hook the vector at target address and branch from there to as many routines as you want. |
|
Back to top |
|
|
|