Vous êtes sur la page 1sur 3

LCD1

LM016L

VSS VDD VEE

RS RW E 4 5 6

1 2 3

U1
9 13 12 40 39 38 37 36 35 34 33 1 2 3 4 5 6 7 8 RESET XTAL1 XTAL2 PA0/ADC0 PA1/ADC1 PA2/ADC2 PA3/ADC3 PA4/ADC4 PA5/ADC5 PA6/ADC6 PA7/ADC7 PB0/XCK/T0 PB1/T1 PB2/INT2/AIN0 PB3/OC0/AIN1 PB4/SS PB5/MOSI PB6/MISO PB7/SCK ATMEGA16 PC0/SCL PC1/SDA PC2/TCK PC3/TMS PC4/TDO PC5/TDI PC6/TOSC1 PC7/TOSC2 PD0/RXD PD1/TXD PD2/INT0 PD3/INT1 PD4/OC1B PD5/OC1A PD6/ICP PD7/OC2 22 23 24 25 26 27 28 29 14 15 16 17 18 19 20 21 tx

AVCC AREF

30 32

$regfile = "m16def.dat" $crystal = 8000000

Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up , Prescale = 8 Config Lcd = 16 * 2 Config Lcdbus = 4 Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , Rs = Portc.0 , E = Portc.1 Const K = 100 / 256

Ddra.2 = 0 Porta.2 = 1

7 8 9 10 11 12 13 14

D0 D1 D2 D3 D4 D5 D6 D7

Ddra.3 = 0 Porta.3 = 1

Up Alias Pina.2 Down Alias Pina.3 Dim A As Byte Dim B As Byte Dim Temp As Single Dim A1 As Word Dim S1 As Single

A = 10 B = 100

Locate 1 , 1 Lcd "proyecto" Locate 2 , 1 Lcd "interfaces" Waitms 50 Cls Cursor Off Do If A > 9 And A < 250 Then If Up = 0 Then Waitms 100 A = A + 10

End If If Down = 0 Then Waitms 100 A = A - 10 End If End If

Pwm1a = A

B = 256 - A

Pwm1b = B