• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

Interacting with CFA-635

samuelmoneill

New member
Hi guys,

I am currently writing a program in C language to communicate with the CFA-635 from a WinXP machine through Serial Port COM1.

I have been using the linux code provided on this site as a reference.

My code will compile for me and as far as I know it opens COM1 as intended but will not send data to the LCD screen.

I will include my source files as .txt files

port.txt should be changed to port.c
cf_packet.txt should be cf_packet.h
If you make these 2 changes it should compile for you

Does anyone know what I need to do to get my program to send characters to the screen or interact with the CFA-635?

Any help would be greatly appreciated.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Attachments

I can offer some comments about your code syntax, but I don't know if that is the cause of your problems.
Code:
    hPort = ConfigureSerialPort("COM1");
In my Win serial code, comm port names have a colon at the end (e.g. "COM1:").
Code:
    send_packet();
    getchar();
    getchar();
    ClosePort();
What are the two getchar() calls for? If you are expecting to get the response to your command, the return packet from the module is always longer than 2 bytes.
Code:
BOOL ReadByte(BYTE  resp)  // should be ([B][COLOR="Red"]BYTE *resp[/COLOR][/B])
{
        // code snipped
        if (dwBytesTransferred == 1)
        {
            resp=rx;     // should be [B][COLOR="Red"]*resp = rx[/COLOR][/B];
            bReturn  = TRUE;
        }
        // code snipped
}

BOOL ReadString(void *outstring, int *length)
{
    BYTE data;
    // code snipped
    while(ReadByte(data)== TRUE)    // should be [B][COLOR="Red"]&data[/COLOR][/B];
    {
        dataout[index++] = data;
    }
    // code snipped
}
You are passing a value, where you should be passing a pointer.

Also, I don't see a prototype or body for "write()".
 
USB LCD Displays - Graphic and Character LCDs with a Keypad
Top