閲覧総計:773  (本日:1  昨日:1)

【黴甆】(霾をクリックすると、そこへ斁べます)


LED凴樲硼(16F84A)

懌晶ディスプレイへ樲をするだけ㐂の
プログラムを作乕し、LEDを您した。
また、HI-TOP C PRO(Late modo)のLED夒した。  08/01/01

LED傹煒䈎埽の暤64文字×2byteLED
SC1602BS-B-XA-GB-K 10800円 を勨いた。 08/01/01
http://www.ipic.co.jp/ipi.html

P1020014.JPG16F886.JPG

MikroCのプログラム

/**
* LED表示(基礎) LED 4bit接続の確認
*
* LED:SC1602BS-B-XA-GB-K 10800円
* http://www.ipic.co.jp/ipi.html
* LEDデータpin D4:RB0 D5:RB1 D6:RB2 D7:RB3 
* LED制御pin EN:RC4  RW:RC5  RS:RC6
* 電源:Daniel電池3本(4.5V)
*
* 16F84A
* Clock: 8.0MHz 内臓発信器使用
* Device Flags:
* _INTRC_OSC_NOCLKOUT _WDT_OFF _PWRTE_ON _MCLRE_OFF
* _CP_

ed to the LCD EN bit (enable)

 *	
#ifndef _XTAL_FREQ
	// Unless specified elsewhere, 8MHz system frequency is assumed
	#define _XTAL_FREQ 8000000
#endif

#include	<htc.h>
#include	"lcd.h"
RS RC6
#define	TB

#define	LCD_
#define	LCCD_DATA = ( ( c >> 4 ) & 0x0F );
	LCD_STROBE();
	LCD_DATA = ( cD_RW RC5
#define LCD_EN RC4

#define LCD_DATA	PORLCD_STROBE()	((LCD_EN = 1),(LCD_EN=0))

/* write a byte to the LCD in 4 bit mode */
void
lcd_write(unsigned char c)
{
	__delay_us(40);
	L & 0x0F );
	LCD_STROBE();
}

/*
 * 	Clear and home the LCD
 */
void
lcd_clear(void)
{
	LCD_RS = 0;
	lcd_write(0x1);
	__delay_ms(2);
}

/* write a string of chars to the LCD */
void
lcd_puts(const char * s)
{
	LCD_RS = 1;	// write characters
	while(*s)
	specified position
 */
void
lcd_goto(unsigned char pos)
{
	LCD_RS = 0;
	lcd_write(0x80+pos);
}
	
/* initialise the LCD - put into 4 bit mode */
void
lcd_init()
{
	char init_value;

	ADCON1 = 0x06;	// Disable analog pins on PORTA


	__delay_us(200);
	LCD_DATA = 2;	// Four bit mode
	LCD_STROBE();

	lcd_write(0x28); // Set interface length
	lcd_write(0xF); // Display On, Cursor On, Cursor Blink
	lcd_clear();	// Clear screen
	lcd_write(0x6); // Set entry Mode
}

●↓lcd.cの設定(分割コンパイル)

LCD分割コンパイル.JPG

★この情報は役に立つ?

選択肢 投票
Express 24  
local 3  
Out of service 125  
  • はじめるPICの書籍は超わかりづらいので買わないでくださいね -- キホンから? 2015-02-13 (金) 11:02:13
  • キホンからはじめるダメな本 -- 2015-02-13 (金) 11:02:37