KOGNA RS485 SLAVE ID
Moderators: TomKerekes, dynomotion
KOGNA RS485 SLAVE ID
I have RM782MB I/O mudule, baud rate 34800 , slave ID:10 please give me
example for read inputs code, I don't found any solution for this module...
https://www.valduino.com/wp-content/upl ... M782MB.pdf
example for read inputs code, I don't found any solution for this module...
https://www.valduino.com/wp-content/upl ... M782MB.pdf
Re: KOGNA RS485 SLAVE ID
Kmotion 5.3.6 ver.
JP12 PIN7 connected to RM782M RS485 A
JP12 PIN8 connected to RM782M RS485 B
JP12 PIN40 connected to RM782M RS485 GND This VALDUİNO connection software a section source code , I open the Valduino software , select 38400 baudrate - Slave ID 10 and connected, no any problem.
JP12 PIN7 connected to RM782M RS485 A
JP12 PIN8 connected to RM782M RS485 B
JP12 PIN40 connected to RM782M RS485 GND This VALDUİNO connection software a section source code , I open the Valduino software , select 38400 baudrate - Slave ID 10 and connected, no any problem.
- TomKerekes
- Posts: 2711
- Joined: Mon Dec 04, 2017 1:49 am
Re: KOGNA RS485 SLAVE ID
Hi kizilkaya,
Attached is an example that should read the 8 Inputs to Kogna Virtual Bits 48-55 and write Virtual Bits 56-63 to the outputs Using Kogna's RS485 Port. It is untested. Your example doesn't help much because the library functions weren't provided or documented.
This table defines the ModBus Commands
These functions move the ModBus Register data to/from Kogna Virtual Bits
To aid in debugging you might connect the device directly to the PC and use this modpoll utility to verify the commands.
HTH
Attached is an example that should read the 8 Inputs to Kogna Virtual Bits 48-55 and write Virtual Bits 56-63 to the outputs Using Kogna's RS485 Port. It is untested. Your example doesn't help much because the library functions weren't provided or documented.
This table defines the ModBus Commands
Code: Select all
ModbusMaster_Cmds ModbusMaster_MonitorList[] = {
// string is "dev,cmd,adrhi,adrlo,lenhi,lenlo" bytes of modbus command. bytelen, data, and checksum are added as necessary.
{"\x0A\x03\x9C\x61\x00\x08", 6, 0}, //ID=10, Read Holding Registers as inputs to MBRegisters[0-7] starting Modbus address 40033 decimal
{"\x0A\x10\x9C\x51\x00\x08", 6, 8}, //ID=10, Write MBRegisters[8-15] to Output Holding Registers starting Modbus Address 40017 decimal
{0, 0, 0} // end flag
};
Code: Select all
// marshal and move values read from PLC/Slave into MBRegisters to KFlop memory
void ModbusMaster_RegUnload()
{
// Move 8 PLC inputs to virtual bits via MBRegisters[0]
// Note use SetStateBit which is Atomic and Thread Safe
int i;
for (i = 0; i < 8; i++)
SetStateBit(48 + i, MBRegisters[i] & 1); // 8 input bits
}
// marshal and move values to be sent to PLC/Slave into MBRegisters
void ModbusMaster_RegLoad()
{
// Move 8 virtual bits to PLC outputs via MBRegisters[1]
int i;
for (i = 0; i < 8; i++)
MBRegisters[8+i] = ReadBit(48 + 8 + i); // the 8 output bits after the 8 input bits
}
HTH
- Attachments
-
- ModbusMaster.h
- (562 Bytes) Downloaded 26 times
-
- ModbusMasterVer3 RM782MB.c
- (17.46 KiB) Downloaded 24 times
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: KOGNA RS485 SLAVE ID
Sorry for the delay, I bought 2 Kogna boards, the first Kogna overheated after 9 hours while it was only plugged into my computer (powered by USB) and nothing was connected to the sockets and the (TMS320C6748) integrated circuit burned.
Since I started using the second Kogna, sometimes every two hours and sometimes every 10 minutes it gives the errors "Error Extracting Version information from file" and "can't open file : xxx.out", I tried all versions from 5.3.3 to 5.3.6 but I couldn't solve the problem, I extracted the C programs from their current folders and put them in the "C Programs" folder and ran them but my problem is the same, I couldn't go to the section about 485 because I couldn't run the card properly.
Note: I used the Ethernet cable that came with the Kogna, when the problem didn't solve it, I used an extra grounded Ethernet cable but my problem is still the same.
I couldn't figure out where I went wrong.
Since I started using the second Kogna, sometimes every two hours and sometimes every 10 minutes it gives the errors "Error Extracting Version information from file" and "can't open file : xxx.out", I tried all versions from 5.3.3 to 5.3.6 but I couldn't solve the problem, I extracted the C programs from their current folders and put them in the "C Programs" folder and ran them but my problem is the same, I couldn't go to the section about 485 because I couldn't run the card properly.
Note: I used the Ethernet cable that came with the Kogna, when the problem didn't solve it, I used an extra grounded Ethernet cable but my problem is still the same.
I couldn't figure out where I went wrong.
- TomKerekes
- Posts: 2711
- Joined: Mon Dec 04, 2017 1:49 am
Re: KOGNA RS485 SLAVE ID
Hi kizilkaya,
Sorry to hear you are having problems. That would be very strange for Kogna to fail without anything connected.
Regarding "Error Extracting Version information" that would indicate some issue reading that DSPKOGNA.out file. I don't think it would be anything with the Ethernet or Kogna. That would be regarding the Compiler reading that file on the PC. I'm not aware of anyone else having this problem. Is there something special you are doing? When does it happen? Under what circumstances? Can you use a process of elimination to see what it is related to? Can you try a different PC?
You sent me many programs, I'm not sure which and how they are being used. I noticed one issue. IO_REG.c has:
This would set persist variable 300 to be used (and 600) for doubles where there are only 200 persist variables available. This could corrupt memory.
Please change back to 10. Although I don't see anywhere your code is using it.
Also StartThread can cause a problem if called when the Thread is already running. Please make sure the Thread is paused, if uncertain, before starting it with:
Sorry to hear you are having problems. That would be very strange for Kogna to fail without anything connected.
Regarding "Error Extracting Version information" that would indicate some issue reading that DSPKOGNA.out file. I don't think it would be anything with the Ethernet or Kogna. That would be regarding the Compiler reading that file on the PC. I'm not aware of anyone else having this problem. Is there something special you are doing? When does it happen? Under what circumstances? Can you use a process of elimination to see what it is related to? Can you try a different PC?
You sent me many programs, I'm not sure which and how they are being used. I noticed one issue. IO_REG.c has:
Code: Select all
#define TMP 300
Please change back to 10. Although I don't see anywhere your code is using it.
Also StartThread can cause a problem if called when the Thread is already running. Please make sure the Thread is paused, if uncertain, before starting it with:
Code: Select all
PauseThread(2);
WaitNextTimeSlice();
StartThread(2);
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: KOGNA RS485 SLAVE ID
The problems occur both when the g code is running and when it is not running, sometimes as soon as the KmotionCNC is running, sometimes 10 minutes and sometimes every 2 hours, there is no clear period.
I will try with a different computer tomorrow, but when I use TMP 10 in IO_REG.c, the tool change program (OMEOS_TC.c) does not work stably, I do not have enough information about TMPs, this is probably the basis of all the problems, things I will try tomorrow;
1) IO_REG.c TMP300 - change TMP10
2) I will use PauseThread(2) and wait ( WaitNextTimeSlice(); ) before StartThread(2);
3) I will change the computer.
I will try with a different computer tomorrow, but when I use TMP 10 in IO_REG.c, the tool change program (OMEOS_TC.c) does not work stably, I do not have enough information about TMPs, this is probably the basis of all the problems, things I will try tomorrow;
1) IO_REG.c TMP300 - change TMP10
2) I will use PauseThread(2) and wait ( WaitNextTimeSlice(); ) before StartThread(2);
3) I will change the computer.
- TomKerekes
- Posts: 2711
- Joined: Mon Dec 04, 2017 1:49 am
Re: KOGNA RS485 SLAVE ID
Hi kizilkaya,
TMP is used by KflopToKMotionCNCFunctions.c in a number of functions. But I haven't found you using any.
KMotionCNC has M6 configured to use VAR 9. When invoked this will place the Slot in 9 and the ID in 10. I suppose this could be a conflict. But 10 is not being referenced.
That message should only occur if a C Program is being compiled to download. Strange that it would occur without GCode running. Otherwise when a Button is pushed. It seems you are using a custom screen but you didn't include the files. You might switch to a non-custom screen for a while to see if it is related. It seems there is a forever loop that does some Screen Script. That shouldn't compile any C Programs but you might disable the forever loop to see if it is related.The problems occur both when the g code is running and when it is not running, sometimes as soon as the KmotionCNC is running, sometimes 10 minutes and sometimes every 2 hours, there is no clear period.
TMP is used by KflopToKMotionCNCFunctions.c in a number of functions. But I haven't found you using any.
KMotionCNC has M6 configured to use VAR 9. When invoked this will place the Slot in 9 and the ID in 10. I suppose this could be a conflict. But 10 is not being referenced.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.