Serial_Write_Char() - Question

Hi,

When using the “Serial_Write_Char()” function I know the correct syntax is “int port,int ch_out.”

However when I use “Serial_Write_Char(TTL_PORT,52);” the “Program State” LED stays orange. What am I doing wrong?

Thanks,
Nathan

Running IFI default code? Called Serial_Driver_Initialize() before hand? Did anyone modify the IFI default low interrupt handler and remove CheckUartInts() call?

A random guess is the interrupt flag is being set but never cleared.

This is the end part of “User_Initialization” in user_routines.c


  relay7_fwd = 1;
  relay7_rev = 0;

  Initialize_Falcon();
 
  Putdata(&txdata);             /* DO NOT CHANGE! */

  Serial_Driver_Initialize();

  printf("IFI 2006 User Processor Initialized ...\r");  /* Optional - Print initialization message. */

  User_Proc_Is_Ready();         /* DO NOT CHANGE! - last line of User_Initialization */
}

The “Initialize_Falcon()” is where I try to write to the TTL port. As you can see it IS above “Serial_Driver_Initialize(),” but I can’t move it down because the it would be below Putdata?

Thanks,
Nathan

I’m not sure I see the problem of moving it down. But if you can’t, you can’t (not sure why as IFI initialization has already done two Putdata() calls to init both low level buffers). Try the following…

 
  relay7_fwd = 1;
  relay7_rev = 0;


 
  Putdata(&txdata);             /* DO NOT CHANGE! */

  Serial_Driver_Initialize();
  Initialize_Falcon();
  statusflag.TX_UPDATED = 0;    /*reset these to update latest data later*/
  Putdata(&txdata);                  /*put data out again */

  printf("IFI 2006 User Processor Initialized ...\r");  /* Optional - Print initialization message. */

  User_Proc_Is_Ready();         /* DO NOT CHANGE! - last line of User_Initialization */
}

I don’t see why you shouldn’t be able to move the Initialize_Falcon down, but you can definitely move the serial initialize up. In any case, you have to call the initializer before you can use the serial ports.

Ok, so I actually ended up moving my initialization function to process_Data_From_Master_uP() and just making sure it only gets called once.

It works now :slight_smile:

Thanks,
nathan