Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

MODBUS master on XMEGA

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
unzeitig

Bascom Member



Joined: 31 Jan 2008
Posts: 25

czechrepublic.gif
PostPosted: Mon Jul 29, 2019 4:00 pm    Post subject: MODBUS master on XMEGA Reply with quote

Can somebody explain me why it does not work - it prints ABC only and stay running on Print #1 , Makemodbus(2 , 3 , B , 8); row.
When I try it with MEGA128 - it works properly.


[code]
$regfile = "xm128a3udef.dat"
$hwstack = 64
$swstack = 40
$framesize = 40
$lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
$lib "modbus.lbx"
'---------------------------------------------------------------

Const Crystalfrekq = 32000000
$crystal = Crystalfrekq
Config Osc = Disabled , 32mhzosc = Enabled , 32khzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'CPU Clock = 32MHz
Bitwait Osc_status.1 , Set 'Check if 32MHz Oscillator is ready
Bitwait Osc_status.2 , Set 'Check if internal 32.768 KHz Oscillator is ready
Osc_dfllctrl.0 = 0
Dfllrc32m_ctrl.0 = 1 'enable



Config Com1 = 9600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8


Open "COM1:" For Binary As #1


'dimension some variables
Dim B As Byte


B = &H26


Do

Print #1 , "ABC"
Print #1 , Makemodbus(2 , 3 , B , 8);

Loop

End
[/code]

[b][color=red](BASCOM-AVR version : 2.0.8.1 )[/b][/color]
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Tue Jul 30, 2019 11:17 am    Post subject: Reply with quote

it seems the xmega.lib and the modbus.lib got out of sync.
I attached a corrected version.

_________________
Mark
Back to top
View user's profile Visit poster's website
unzeitig

Bascom Member



Joined: 31 Jan 2008
Posts: 25

czechrepublic.gif
PostPosted: Tue Jul 30, 2019 11:38 am    Post subject: Reply with quote

Now it works, thank you for fast reply.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
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
You cannot attach files in this forum
You cannot download files in this forum