'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2011 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 22/11/2011 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
Device = 16F877
Xtal = 4
' Conformation des ports
LCD_DTPin = PORTD.4
LCD_RSPin = PORTE.0
LCD_ENPin = PORTE.1
LCD_Interface = 4 ' 4-bit Interface
LCD_Lines = 2
LCD_Type = 0
LCD_CommandUs = 2000
LCD_DataUs = 50
Hserial_Baud = 9600 ' Transmision � 9600 bauds
Hserial_RCSTA = %10010000 ' UART actif en r�ception continue
Hserial_TXSTA = %00100100 ' UART actif en transmission en mode asynchrone
Hserial_Clear = On ' Trap des erreurs de r�ception
' Keypad_Port = PORTB
All_Digital = TRUE ' PORTA et PORTB en mode digital
PortB_Pullups = On
OPTION_REG.7 = 0 ' R�sistances de tirage PORTB actives
DelayMS 100 ' LCD stable
Cls ' Effacement du LCD
Dim BtnVar As Byte ' Workspace for Button instruction.
BtnVar=0
Loop:
Button PORTB.5, 1, 255, 250, BtnVar, 1, Press
NoPress:
GoTo Loop
Press:
Cls
Symbol tempb = PORTB & $1F
Print At 1,1, Dec tempb
Print At 1,10, Dec PORTB & $1F
GoTo Loop