Receive Text data over Canbus

I’m trying to receive text over canbus, the data coming in is string converted to bytes and then sent to CANbus, how can I import this? And display as text?

Hi,

Could you provide an example of the texts you want to transmit via CAN bus?
You could use enumerations to translate ASCI codes into characters, but this might not be the most efficient approach.

Are the texts you want to send predefined (a fixed set of messages), or do you need the ability to display arbitrary text?

If the texts are part of a predefined set, it would be more efficient to use an enumeration(defining the texts within it) and transmit only the number corresponding to the desired text.

The text is arbitrary text, max of 8 characters, it’s not going to update much, maybe every 30 seconds. Would this be possible?

Here is an example project where ASCII codes are decoded into capital letters within an Enumeration element. There aren’t enough enumeration elements to decode both uppercase and lowercase letters simultaneously, so you will need to choose one or perform mathematical operations on the numbers to convert lowercase to uppercase or vice versa.

asciiToChar.adu (6.8 KB)

amazing thanks, I’ll have a go at this over the weekend

it’s cool, that it’s possible to do with ADU, BUT it would already use up all most of the 40 enumeration limit. Is there any reason, this number can’t be increased?

The reason is simply the lack of available memory to extend the number of enumerations.

If its always going to be the same text being displayed…why not just setup flags that trigger enumerations…would be simpler and eat up less memory.

This was a planned off season project for me as well. For mine I want to send numbers that can be used as variables to fill the virtual tank with partial loads vs full.

I would also want some simple pre defined messages. Pre defined messages would only need to read a specific bit or code, would be much easier.

I’m assuming the OP is planning to use Racecapture Text to Car for this.

thanks for this, sadly the asci code is being sent as hex number and not a decimal, I’ve tried to modify your example to do this but failed :frowning: is it possible to convert from hex to ascii in the simular way?

The ASCII code itself is just a number that represents a character. Whether you write it in hexadecimal (hex) or decimal, it’s still the same value. For example:

  • The letter A in ASCII has the decimal value 65.
  • The same A in hexadecimal is written as 0x41.

Both 65 (decimal) and 0x41 (hex) represent the exact same ASCII character A. The difference is only in how you’re choosing to represent the number, not the actual data.

I’m not entirely sure what you’re trying to convert here. Perhaps I misunderstood your post, so could you provide an example of why it’s not working for you?

I follow where you are going, but for example, if the letter M is bing send in hex, this would be 4D, how can I enter this in the table as it only accepts numbers?
The data sent is a string of data as it’s for a digital pit board app I’m creating.

Which table do you want to enter this value into, and why?

If you receive 0x4D on the CAN bus, it will display the letter M. Isn’t that what you needed?