วันอาทิตย์ที่ 19 สิงหาคม พ.ศ. 2550

การเสนอผลงานครั้งที่3


1.แก้ไขปรับปรุง การเขียนโปรแกรมภาษาC ในส่วนของLCD
#include <8051io.h> ;
#include <8051reg.h> ;

LCD_busy()
{
unsigned char in_loop;
for(in_loop=0;in_loops<0x18;in_loops++){
}
}
LCD_enable()
{
{#pragma asm
clr P1.3
#pragma endasm
}
LCD4_busy();
{#pragma asm
setb P1.3
#pragma endasm
}
}
LCD4_write_instruct(command)
unsigned char command;
{
{#pragma asm
set P1.3
#pragma endasm
}
P1 = (P1&0x0F)(command&0xF0);
LCD4_enable();
P1 = (P1& 0x0F)((command<<4)&0x0F);
LCD4_enable();
}
LCD4_putc(ascii)
unsigned char ascii;
{
{#pragma asm
setb P1.2
setb P1.3
#pragma endasm
}
P1 = (P1&0xOF)(ascii&0xF0);
LCD4_enable();
P1 = (P1&0x0F)((ascii<<4)&0xF0);
LCD4_enable();
}
LCD4_puts(lcd_string)
unsigned char *lcd_string;
{
while(*lcd_string){
LCD4_putc(*lcd_string++);
}
}
LCD_init()
{
{ #pragma asm
setb P1.3
clr P1.2
#pragma endasm
}
LCD4_write_instruct(0x33);
LCD4_write_instruct(0x32);
LCD4_write_instruct(0x28);
LCD4_write_instruct(0x0C);
LCD4_write_instruct(0x06);
LCD4_write_instruct(0x01);
}

main()
{
LCD4_init();
LCD4_puts("VELOCITY");

while (1){
}
}
_______________________________________________
2.การเขียน Flow Chart






_________________________________________________


3.Timer/Counter



_________________________________________________

4.โปรแกรมรับสัญญาณpulseโดยผ่านInterface Counter



void pulse_couter(1){
TMOD = 0b00100110 ;
Sbit EA ;
THO = #000H ;
TLO = #000H ;
CLR OVER ;
Sbit ETO ;
Sbit TRO ;
{ #pragma asm
R7 = #100
R6 = #10
R5 = #0E6H
#pragma endasm
}
}



_________________________________________________

5.รูปชิ้นงาน ณ ปัจจุบัน








_________________________________________________