User Tools

Site Tools

한국어

moacon:comput:index

comPut

void comPut (u8 comCh, u8 comChar)

comCh : Channel number
comChar : Byte to transmit

Transmits a single byte, comChar, on channel comCh. To send ASCII characters, comChar should be the character's ASCII code.

#include "moacon500.h"
void cmain(void)
{
 openCom(0, 115200, C8N1);          // Channel 0, 115200 Baud,
                                    // data bits: 8, no parity, stop bits: 1
 while (1)                          // Repeat forever
 {
   delay(500);                      // Wait for 500ms
   comPut(0,0x41);                  // transmits the letter 'A' (ASCII 0x41)
   comPut(0,'B');                   // transmits the letter 'B'
 }
}

A character's ASCII code can be specified using a numeric literal (e.g. 0x41) or using a character literal (e.g. 'A').

To send more than one character, use the comPrint function.

go MOACON home

moacon/comput/index.txt · Last modified: 2016/04/14 11:07 (external edit)