Embedded reading device, C writing

xiaoxiao2021-03-06  63

/ ************************************************** ************************************* File name: main.c ** description: ** generated automatic or for: arm7tdmi-s3c44b0x evatatern board ** Time: Friday, August 13, 2004 11: 42: 11 ** Copyright: wangyinfei ************************************************* **************************************************************************** / # include #include "../inc/44b.h"#include" ./inc/44blib.h"#include "../inc/def.h"#include" ../inc/option .h "#include" www.h "void isr_init (void) {u32 i; // piSR_UNDEF = (unsigned) haltundef; // piSR_SWI = (unsigned) HALTSWI; // piSR_Pabort = (unsigned) HaltPabort; // pisr_dabort = (unsigned) HaltdAbort; for (i = _ram_startaddress; i <(_ ram_startaddress 0x20); i = 4) {* ((volatile unsigned *) i) = 0xEA000000 0x1ffE;} RINTCON = 0x5; // non-vectored, IRQ Enable, FIQ Disable RINTMOD = 0x0; // all = Irq mode rintmsk | = bit_global | bit_eint0; // all interrupt is masked.}

ISR_INIT (); port_init (); lcd_init (); LCD_ACTIVE_CLR (); test_kb (); Digit_LD_SYMBOL (8); LCD_ACTIVE_CLR (); DIGIT_ED_SYMBOL (5); DISP16 (BB, 5, 0); DIGIT_LED_SYMBOL 4); while (1) {DIGIT_LIT_SYMBOL (3); test_kb (); DIGIT_LID_SYMBOL (2); // Keyboardint (); // init_keyboard ();}

} / ****************************** LCD.C file Copyright: Wangyinfei ********* ************************** / # incrude "./inc/44b.h"#include" ../inc/44blib.h " #include "../inc/asii.h"#include" ../inc/hanzi.h "

#define int32u unsigned int16u unsigned Short # define s32 int # define s16 short int # define int8u unsigned char # define u16 unsigned short int rt # define int16 Short

INT P = 0; int pp = 0; char * page [100]; / ****************************************** ******************************************************************************************** ******** / VOID DELAY (long n) {long i; long k; long j; for (i = 0; i

Void Guiswap (INT16 * USY1, INT16 * usY0) {Short M; M = * usy1; * usy1 = * usy0; * usy0 = m; return 0;} / ************* ************************** EMBEST ARM Teaching System Software Macro Definition *************** *********************************** / # Define M5D (N) ((N) & 0x1FFFF) // High 3-bit Sweeping 0 Macro #define Black 0xffffffff # Define White 0x0

/ ************************************************************** * S3C44B0X LCD control register access address ******************************************** * # define rlcdcon1 ( * (voatile unsigned *) 0x1f00000) #define rLCDCON2 (* (voatile unsigned *) 0x1f00004) #define rLCDCON3 (* (voatile unsigned *) 0x1f00040) #define rLCDSADDR1 (* (voatile unsigned *) 0x1f00008) #define rLCDSADDR2 (* ( voatile unsigned *) 0x1f0000c) #define rLCDSADDR3 (* (voatile unsigned *) 0x1f00010) #define rREDLUT (* (voatile unsigned *) 0x1f00014) #define rGREENLUT (* (voatile unsigned *) 0x1f00018) #define rBLUELUT (* (voatile unsigned *) 0x1f0001c) #define rDP1_2 (* (voatile unsigned *) 0x1f00020) #define rDP4_7 (* (voatile unsigned *) 0x1f00024) #define rDP3_5 (* (voatile unsigned *) 0x1f00028) #define rDP2_3 (* (voatile unsigned *) 0x1f0002c) #define rdp5_7 (* (voatile unsigned *) 0x1f00030) #define rdp3_4 (* (voatile unsigned *) 0x1f00034) #define rdp4_5 (* (voatile unsigned *) 0x1f00038) #define rdp6_7 (* (voatile unsigned *) 0x1f0003c) #define rdithmode (* (voatile unsigned *) 0x1f00044) * // ********************************* ***************** S3CEV40 LCD attribute of the experiment system definition ********************************** ***************************** / # Define MLCD_320_240 (3) #define LCD_TYPE MLCD_320_240 # Define SCR_XSIZE (160) #define SCR_YSIZE (240) #define LCD_XSIZE (160) #define LCD_YSIZE (240) / ************************************************************* * S3C44B0X LCD controller macro definition ************************************************************ ****** / # Define Mide_grey16 (16) #define CLKVAL_GREY16 (13)

#define lineval (lcd_ysize-1) #define mval (13) #define mval_used 0 / ********************* ************************* EMBEST ARM Teaching System LCD Shop *********************** ****************************************** / # define array_size_grey16 (SCR_XSIZE / 2 * SCR_YSIZE) #define LCD_BUF_SIZE (SCR_XSIZE * SCR_YSIZE / 2) #define lcd_active_buffer (0xc400000) #define lcd_virtual_buffer (0xc400000 LCD_BUF_SIZE)

/ ************************************************** Function name: LCD_INIT () * Function: Initializing the LCD Controller * Parameters: None * Return: None *************************** ********************* / VOID LCD_INIT (VOID) {RDITHMODE = 0x1223A; RDP1_2 = 0x5a5a; RDP4_7 = 0x366cd9b; RDP3_5 = 0xDA5A7; RDP2_3 = 0xAD7; RDP5_7 = 0xFeda5b7; RDP3_4 = 0xebd7; RDP4_5 = 0xEBFD7; RDP6_7 = 0x7EFDFBF;

/ * --------------- LCDCON1 control word clear 0 ---------------- / rlcdcon1 = (0) | (1 << 5) | (mval_used << 7) | (0x3 << 8) | (0x3 << 10) | (CLKVAL_GREY16 << 12); / * ------------- LCDCON2 Control Word set LCD resolution 320 * 240, horizontal line scan idle time 10MCLK ---------------- * / rlcdcon2 = (lineval) | (hozval << 10) | (10 << 21 ); / * --------------- LCDSADDR1-3 is the start address of the frame buffer -------------- * / rlcdsaddr1 = 0x0 << 27) | ((LCD_ACTIVE_BUFFER >> 22) << 21) | M5D (LCD_ACTIVE_BUFFER >> 1)); / * -------------- Set: 16 gray gray Degree, lcdbank, lcdbdeu --------------- * / rlcdsaddr2 = M5D (((LCD_ACTIVE_BUFFER (SCR_XSIZE * LCD_YSIZE / 2/4) >> 1)) | (MVAL << 21); RLCDSADDR3 = (LCD_XSIZE / 4/4) | ((SCR_XSIZE-LCD_XSIZE) / 4/4) << 9); // Reset LCDCON1: 4-bit single scan mode; WDLY = 8CLK, WLH = 8clkrlcdcon1 = (1) | (1 << 5) | (mval_used << 7) | (0x3 << 8) | (0x3 << 10) | (CLKVAL_GREY16 << 12); RBLuELUT = 0xFA40; / * ----- ---------- LCD drive logic enable, open back --------------- * / rpdate = rpdate & 0x0e;} / ******* ********************************** Pixel function, LCD pixel displays LCDPUTPIEL (X, Y, C) - ---- Send to the display buffer (direct drive LCD) ********************************************* ******** / LCDPUTPIEL (INT16 x, INT16 Y, INT8U C) {INT32U * Buffer = (int32u *) LCD_ACTIVE_BUFFER; * (BU Ffer y * SCR_XSIZE / 32 X / 32) | = (0x80000000 >> (x% 32));} / ********************** *************************** // function name LCD_ACTIVE_CLR () // Function clear screen // parameter No // Return *** **************************************************** / VOID LCD_ACTIVE_CLR (void) { INT32U i; int32u * pdisp = (int32u *) LCD_ACTIVE_BUFFER; for (i = 0; I <(SCR_XSIZE * SCR_YSIZE / 8); i ) {* pdisp = White;} return;

} / ******************************************************* *** Displays the function of the specified buffer data ******************************************************** *********** / VOID DISPLAYLCD (unsigned f * pBuffer, temp_data; int i; pBuffer = (int16u *) LCD_ACTIVE_BUFFER; for (i = 0; i <(4800 / 4); i ) {TEMP_DATA = (BUF [i * 4] << 24) (BUF [i * 4 1] << 16) (BUF [i * 4 2] << 8) ( BUF [i * 4 3]); PBuffer [I] = ~ TEMP_DATA; DELAY (3);}} / ********************** *************** // Function name LCD_DRAW_HLINE () // Function Specified color painted horizontal line // parameter USX0, USY0 start coordinate // USX1 end X coordinate // ucolor line color // Return / *************************************************************************************************************************************************TION *** English shows 16x16 ************************************************************************** Dischar16 (Char hao, unsigned char line, unsigned char xdot) {unsigned char * pbuffer; unsigned int i; if (xdot% 2 == 0) xdot = 1; else xdot- = 1; // delay (1);

PBuffer = (unsigned char *) LCD_ACTIVE_BUFFER; for (i = 0; i <16; i ) {PBuffer [20 * i 16 * 20 * line xdot * 2] = hzdot [2 * i 1 32 * hao ]; PBUFFER [20 * i 16 * 20 * line xdot * 2 1] = hzdot [2 * i 32 * hao];}} / ************** ****************** English string display 16x16 ******************* ********************************** / VOID DISSTR16 (char * hao, unsigned char line, unsigned char xdot) {char * m = hao; while * m! = 0) {if (* m == '/ n') {line ; xdot = 0; m ;} if (xdot> = 10) {xdot- = 10; line ;} if (line> = 15 ) {line- = 15; delay (3); LCD_ACTIVE_CLR ();} dischar16 (* m, line, xdot); M ; xdot ;}} / *************** ***************** Chinese string display 16x16 ****************** ************************ / VOID DISP16 (char * hao, unsigned char line, unsigned char xdot) {unsigned char * pBuffer; unsigned int i, X, Y; unsigned char xx; // delay (1);

转载请注明原文地址:https://www.9cbs.com/read-111552.html

New Post(0)