I have trouble using the serial interface of my calculator. I thought that the following code would output tons of 'A's, but it does not. I would be happy if anyone could help me out with this.
Code:

#include <fxcg/serial.h>

int main() {
        unsigned char writes = 'A';
        if (Serial_IsOpen() == 1) {
                Serial_Close((int)1);
        }
        unsigned char mode[6] = {0, 5, 0, 0, 0, 0};
        Serial_Open(mode);
        while(1) {
                Serial_WriteUnbuffered(writes);
        }
        return 0;
}
What are the return values of Serial_Open and Serial_WriteUnbuffered? How are you checking for the serial output? I presume you're using an adequate cable with RS232 <-> TTL level conversion, and on the software side, that the serial port is open at 9600 baud, 8 data bits, no parity, 1 stop bit?

Is the 3-pin cable fully inserted into the calculator? (I know it appears to be a dumb question, but with new calculators it's very common that a little bit of extra force need to be applied for it to really get in the correct position).

Also, I recommend closing the serial port at the end of the program.
Both functions return a 0. I am checking for the output by using a Bus Pirate (yes, it does work). I allready was wandering if the jack or the cable is damaged, so soldered directly to the PCB, but I still can not get any output.
Do you get any output (even if just noise) when using the OS to attempt a 3-pin file transfer? What about using an add-in like fxterm which is known to work? Just trying to rule out the possibility of hardware failure on either end.
Coincidentally I am also working on Serial interface right now - so I thought I would ask if you project succeeded back then, cookie_swap?
Yes! But I almost immediately lost interest then and I do not have the code anymore. But I made a bad™ Rolling Eyes code dumper. I don't know if it works (I sends stuff, but I have not checked it for correctness). I used the INSIGHT Plugin instead. But a similar, modified version of this was able to output static strings.

Code:

static unsigned char serialMode[6] = {0, 5, 0, 0, 0, 0};

void dumpToSerial(unsigned int * startAddress, unsigned int size) {
  unsigned int i;
  if (Serial_IsOpen() == 1) {
    Serial_Close(1);
  }
  Serial_Open(serialMode);
  for (i = 0; i < size; i++) {
    while(1) {
      response = Serial_WriteSingle(*(startAddress + i));
      if (response == 0) {
        break;
      } else if (response == 2) {
        // Transmit Buffer is full, we need to wait
      } else if (response == 3) {
        PrintXY(1,2,"  Not Open",0x00,TEXT_COLOR_BLUE);
        while(1) GetKey(&key);
        break;
      }
    }
  }
}
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement