0

Sending Text with a Generic CAN

C. Drouaud 3 years ago in IQANdesign updated by Gustav Widén (System support) 3 years ago 9

Hello,


I need to send a channel Text with a generic CAN-BUS to an external display. It seems that Generic parameter doesn't accept Text channel.


How can I do it ?


Thanks in advance. 

Is it a dynamic text or static?

Not sure to know the difference.. Its a channel Text, with a mode. So the text changes between a few proposition when the state mode changes. But on a specific mode, it's always the same text.

Ok then it is static text. How many characters should be sent and how does the receiver wants the text to arrive? Multi page message?

I can have up to 30 characters, but if necessary I can split them (it's several words as a string, so I can have separate words). If I split them, my longest word is less than 20 characters - norwegian words.

I don't really know how the receiver wants to receive the data because i don't programm it. But I know it's programmed with Codesys and I can tell to the people who program it how do I send the data. It's sent to a radiocontrol display, for displaying depending on the chosen language (handling with the state mode).

The problem is that one Generic Frame can handle 8 characters. So first you need a good CAN specification how the Radio controller wants to receive the text.


To send plain text you just translate the characters to ASCII code.

ASCII Table


To send "Til topps" you need 9 Integer channels to hold one character value each.

T = 84

i = 105

l = 108

 = 32

t = 116

o= 111

p= 112

p= 112

s= 115

Then connect each Integer channels to a separate Generic Parameter Out channels and they are connected to a Generic Frame out. But you can only send 8 character in one Frame so this example would need two frame outs.


For different languages you just add a function selector to the Integer channels.


So its very important you have a CAN specification from the Radio Controller that describe how to send text to it.

Ok, thank you very much for the explanation.

I'm gonna see with the programmers of the radio receiver, but I think it's gonna be very complicated to handle it with IQAN because I don't have just one word but more than 25 words, each in 5 different language...

Maybe it's easier to manage it directly in the radio receiver.

I've never seen text strings sent by CAN. ASCII would not be efficient in this case. You can map each character to a single bit. A single byte is 255 bits. This is basically a 255 letter alphabet. 




That I would like you to see how you will solve. :)

As Jonas writes, there are two things that one needs to think of when sending text, to make an ascii conversion and to handle text strings longer than 8 bytes. 

Several years ago I made a rather clumsy implementation for sending a few fixed text strings to a CANopen radio, with the fixed texts imported in lookup tables and functionality for stepping through a sequence of multi-packed messages. 


We are looking at a better way of handling this, where the first step will be to send J1939 texts, see:

http://forum.iqan.se/forums/1-software/topics/59-jfout-multi-packet-for-handling-text-strings/