String Array

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: String Array

Post by medelec35 »

Hello scorpy77.
Just a thought. If you want to send a string down a port, have you considered using RS232 component. You can change the external properties from UART to software. Tx can be the pin you send string on. RX can be a pin you don't use.
that way you can strings direct, without conversion first.
Not sure if will suit your needs or not?
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: String Array

Post by Benj »

Hello,

Sorry Flowcode cannot do multi dimension arrays itself. The underlying C compiler can though so you could always create and manipulate the arrays using C code.

What are you trying to output to? The 74HC154 is a 4 -> 16 Multiplexer so im a bit confused when you say you need to send a string.

A string is an array of bytes. A byte is a collection of 8 bits. A bit is used to control the logic level of a multiplexer.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: String Array

Post by Benj »

Hello Scorpy,

Ah I see what your tring to do now. You need to be able to output text onto the display as a string. Or at least to output characters and shift the data along.

What might help is if you take a look at the C code used to print a string onto a graphical display. This basically does the same job you are trying to acheive. There is a large array at the start of the gLCD component C code file that defines the patterns for ascii characters in 5 x 8 bit formatting. There is also an additional column between characters to allow for spacing between individual letters.

If you get stuck then I may have some free time this weekend to try and help you to get started with the basics.

Do you want to be able to print out static data strings. eg print then clear. Or do you want to be able to send out one string and then later another string that shifts the first string along etc.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: String Array

Post by Benj »

Hello,

Right the array data for a letter A is as follows.

0x7E , 0x09 , 0x09 , 0x09 , 0x7E.

The data shown represents 5 columns on the display. Each column contains data for 8 rows in that column, eg the 8-bits in the byte.

Converting the hex numbers shown above into binary looks like this

0, 1, 2, 3, 4

0, 0, 0, 0, 0
1, 0, 0, 0, 1
1, 0, 0, 0, 1
1, 0, 0, 0, 1
1, 1, 1, 1, 1
1, 0, 0, 0, 1
1, 0, 0, 0, 1
0, 1, 1, 1, 0

The Letter A is shown above (though it is upside down woops).

I would start by trying to display a single character onto the LEDs. Once you have done this additional characters should be no problem.

For each character you will need an array of 5 bytes and depending on your hardware you can output as full bytes or you can collect single bits from each byte. You should be able to copy the array directly out of the gLCD code by creating a very simple gLCD program that simply initialises the component. Once you have done this compile to C and then look at the C file to collect the contents of the Ascii data array.

The print String function of the gLCD component does this exact functionality and even allows for multiple font sizes etc based on multiplying up the height and widths of the text.

Hopefully this will help to get you started.

Post Reply