|
|
View previous topic :: View next topic |
Author |
Message |
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Wed Aug 05, 2015 4:54 am |
|
|
td wrote: | compiler version: 4.119
At last for displaying the data saved in eeprom, we use modbus.ie, via modbus, we are displaying the saved data. For each event, we need 10 different registers. We need to save at least 200 events. |
Okay, and this is probably my last input to this thread, I'd do that by having just ten read-only registers for a single event. Then I'd have a read-only event status register, part, or all of which was a count of the number of recorded events, with maybe a few status flag bits. Maybe I'd arrange for any write to the status register to erase the buffered events, maing that register read-mostly. I'd also have a write-only event select register that selects which event can be accessed through the ten read-only event registers. Twelve registers in all, which could allow access to thousands of events if needed. Thousands of registers are not needed, and are difficult to implement. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Wed Aug 05, 2015 4:56 am |
|
|
There are several things rather 'dubious' in the original code as posted. He doesn't fully setup modbus, then loads the driver, then does the remaining setup, and also does his own #USE RS232 (which duplicates the one in the driver). The effect of this could be problematical:
Code: |
#define MODBUS_TYPE MODBUS_TYPE_SLAVE
#define MODBUS_SERIAL_TYPE MODBUS_RTU
#define MODBUS_SERIAL_INT_SOURCE MODBUS_INT_RDA
#define MODBUS_SERIAL_BAUD 9600 //
#define MODBUS_ADDRESS 2 //Channel_No
#define MODBUS_SERIAL_ENABLE_PIN Pin_C5
#define MODBUS_PARITY NONE
//All the modbus settings should be done first.
#include "modbus.c" //then load the driver
|
In particular the enable pin needs to be defined before the driver is loaded. #defines are _not_ recursive.
You say 'errors'. What error(s) does the modbus driver report?.
As a separate comment, have you actually tested that your chip really is running at exactly 20Mhz?. Do something like setup a pin as a PWM, and time this with a frequency meter. I'd be most suspicious that perhaps the crystal is running fractionally off frequency, and hence you are getting data errors. |
|
|
td
Joined: 16 Apr 2015 Posts: 21 Location: India
|
solved |
Posted: Thu Aug 06, 2015 12:19 am |
|
|
idea is great!!!!!!
Quote: | Okay, and this is probably my last input to this thread, I'd do that by having just ten read-only registers for a single event. Then I'd have a read-only event status register, part, or all of which was a count of the number of recorded events, with maybe a few status flag bits. Maybe I'd arrange for any write to the status register to erase the buffered events, maing that register read-mostly. I'd also have a write-only event select register that selects which event can be accessed through the ten read-only event registers. Twelve registers in all, which could allow access to thousands of events if needed. Thousands of registers are not needed, and are difficult to implement. |
exactly....
i can implement....
Thank you very much for your great idea..... |
|
|
|
|
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
|