anaIN and Modbus/TCP

Hello everybody.
I’ve been searching through the forum for a few hours and haven’t gotten any closer to solving my problem, so i guess it’s time for a new thread.

I’m trying to use the BL4S200 to read an analog input, and somehow communicate that information over Modbus TCP/IP.

I have gotten the 4-20mA input reading with the example code provided with Dynamic C 10.64, but I’m wondering how i go about storing that value to a register to be read from a Modbus device.

I would like the BL4S200 to be a Modbus Slave, and I have a touchscreen acting as a Modbus Master.

There’s so much documentation on the net/ included with the software that it’s a very daunting task to sort through it all and find the bits of information i need.

If anyone could point me in the right direction, or provide some tips, it would be greatly appreciated.


Edit

And it’s only just now that i realized i posted in the wrong section… anything i can do about that? - Sorry

Your best starting point for this is probably to look at the lib\rabbit4000\modbus\modbus_slave_bl4s1xx.lib file as ane example for very similar hardware for the analog input side of things.

You would havge to produce a similar library for the BL4S2xx controller which should not be too difficult a task.

Regards,
Peter

I must also mention that I’m pretty much a novice at coding.
I have programmed a PIC in BASIC, and the touchscreen I’m using has C scripting abilities, but nothing too fancy.

How would i go about producing a library?

I’m afraid you are going to have to spend a bit of time getting familiar with the development environment for the Rabbit devices and working your way through the documentation and examples.

There are plenty of examples provided with the compiler and at least in the case of the modbus slave library you have a good starting point with the BL4S1xx library which should be amenable to copying and modifiying to suit your needs for the BL4s2xx products.

Regards,
Peter

I have made a copy of the BL4S1xx library and renamed it BL4S200.
What modifications do i need to make to the library in order to use my board?

Or where can i find out what information to change / add?

I’m also getting a few errors when i compile:

line 320 : ERROR MODBUS_SLAVE_BL4S200.LIB : __brdInitFlag is out of scope/ not declared.

So i did a search and i put the following into the library:

/*** BeginHeader __brdinitflag */
extern int __brdinitflag;
/*** EndHeader */
int __brdinitflag; //Board init function flag

That didn’t work and I’m not sure how to pursue that error further, as i can’t find any other threads or information about it. (yet)

The second compile error is: line 325 : WARNING MODBUS_SLAVE_BL4S200.LIB : Reference to ‘digIn’ has no corresponding prototype.

Should i use the header tags with the digin as well?