30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

WriteDataXLCD<br />

Description: This function writes a data byte (one character) from the P-tec<br />

PCOG1602B LCD controller.<br />

Include: xlcd.h<br />

Prototype: void WriteDataXLCD (char data);<br />

Arguments: data The value of datacan be any 8-bit value, but should<br />

correspond to the character RAM table of the P-tec<br />

PCOG1602B LCD controller.<br />

Return Value: None<br />

Remarks: This function writes a data byteto the P-tec PCOG1602B LCD<br />

controller. The user must first check to see if the LCD controller is busy<br />

by calling the BusyXLCD()function.<br />

The data read from the controller is for the character generator RAM or<br />

the display data RAM depending on the previous Set??RamAddr()<br />

function that was called where ??refers to either CG or DD.<br />

Source File: WriteDataXLCD.c<br />

Code Example: WriteDataXLCD(0x30);<br />

dsPIC Peripheral Libraries<br />

2004 Microchip Technology Inc. DS51456B-page 79<br />

WriteCmdXLCD<br />

Description: This function writes a commandto the P-tec PCOG1602B LCD<br />

controller.<br />

Include: xlcd.h<br />

Prototype: void WriteCmdXLCD (unsigned char cmd);<br />

Arguments: cmd This contains the LCD controller parameters to be configured<br />

as<br />

defined below:<br />

Type of interface<br />

FOUR_BIT<br />

EIGHT_BIT<br />

Number of lines<br />

SINLE_LINE<br />

TWO_LINE<br />

Segment data transfer direction<br />

SEG1_50_SEG51_100<br />

SEG1_50_SEG100_51<br />

SEG100_51_SEG50_1<br />

SEG100_51_SEG1_50<br />

COM data transfer direction<br />

WriteCmdXLCD (DON);<br />

WriteCmdXLCD (SHIFT_DISP_LEFT);<br />

dsPIC<br />

®<br />

Thư viện Công cụ Ngôn ngữ<br />

DS51456B trang 80 2004 Microchip Technology Inc<br />

3.3.2 Ví dụ về sử dụng<br />

# xác định __dsPIC30F6014__<br />

# include<br />

# include<br />

/ * Giữ địa chỉ của tin nhắn * /<br />

char * buffer;<br />

dữ liệu char;<br />

mesg1 char [] = {'H', 'A', 'R', 'D', 'W', 'A', 'R', 'E', '\ 0'};<br />

mesg2 char [] = {'P', 'E', 'R', 'tôi', 'P', 'H', 'E', 'R', 'A', 'L'<br />

'', 'L', 'tôi', 'B', '', '\ 0'};<br />

int main (void)<br />

{<br />

/ * Giao diện Set 8 bit và hai màn hình hiển thị dòng * /<br />

OpenXLCD (EIGHT_BIT & TWO_LINE & SEG1_50_SEG51_100<br />

& COM1_COM16);<br />

/ * Chờ cho đến khi bộ điều khiển màn hình LCD đang bận rộn * /<br />

trong khi (BusyXLCD ());<br />

/ * Bật màn hình * /<br />

WriteCmdXLCD (DON & CURSOR_ON & BLINK_OFF);<br />

đệm = mesg1;<br />

PutsXLCD (đệm);<br />

trong khi (BusyXLCD ());<br />

/ * Thiết lập địa chỉ DDRAM đến 0x40 để dispaly dữ liệu trong dòng thứ hai *<br />

SetDDRamAddr (0x40);<br />

trong khi (BusyXLCD ());<br />

đệm = mesg2;<br />

PutsXLCD (đệm);<br />

trong khi (BusyXLCD ());<br />

trở về 0;<br />

}<br />

dsPIC Thư viện ngoại vi<br />

2004 Microchip Technology Inc DS51456B trang 81<br />

3.4 chức năng CAN<br />

Phần này bao gồm một danh sách các chức năng riêng biệt cho CAN và một ví

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!