Hi, malc
No, Life is not hard ...
you use chips with lots and lots of features available, and you do not "tell" it the ones you want to use ...
never forget your chip CONFIG paragraph ... it's 50% of the project good achievement ...
a small example:
Code:
'*****************************************************************************
'*****************************************************************************
' ThermoPID F84 test sur EasyPic5
' Thermostat PID 16F877a + DS 18B20
' 12/12/2009 : 3567 Lignes
'
'
' ATTENTION : DS1820 ... OFFSET ERROR !!!
'*****************************************************************************
'*****************************************************************************
'*****************************************************************************
'*****************************************************************************
@ ERRORLEVEL -306
@ __config _HS_OSC & _WDT_ON & _PWRTE_ON & _BODEN_ON & _LVP_OFF & _CP_OFF
'*****************************************************************************
'* LCD Defines for EasyPic5 *
'*****************************************************************************
DEFINE LCD_DREG PORTB ' I/O port where LCD is connected
DEFINE LCD_DBIT 0 ' 0, 1, 2, 3
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 4 ' Register select pin
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 5 ' Enable pin
DEFINE LCD_BITS 4 ' 4-bit data bus
DEFINE LCD_LINES 2 ' LCD has 2 character lines
DEFINE OSC 8
DEFINE BUTTON_PAUSE 100
Temp_Down VAR PortA.0 'Temp down button input port
Temp_Up VAR PortA.1 'Temp up button input port
G_LED VAR PortC.0 ' Green LED output cold needed
Relay_Cold VAR PORTC.1
R_LED VAR PortC.6 ' Red LED output hot needed
Relay_hot VAR PortC.7
DQ VAR PortE.2 ' One-wire Data-Pin "DQ" on PortE.2
'*****************************************************************************
' Variables
'*****************************************************************************
delay VAR BYTE 'Button working variable
Loscale VAR BYTE
Hiscale VAR BYTE
Decal VAR BYTE
FAM VAR BYTE ' Sensor Family
ID VAR BYTE[7] ' Sensor ID
CRC VAR BYTE
Unit VAR BYTE ' °C or °F
DS18B20_bit VAR BYTE ' Sensor resolution
Tempeff VAR WORD
Setpoint VAR WORD
R_Temp VAR WORD ' RAW Temperature readings
TempC VAR WORD ' Temp in deg C
TempF VAR WORD
Float VAR WORD ' Holds remainder for + temp C/F display
Tempo VAR WORD
ColdStart VAR BIT
Sign VAR BIT
Busy VAR BIT
PAR VAR BIT ' Parasite Power Flag
Signe Var Word
Err Var Word
P Var Word
I Var Word
Drive Var Word
Lasterr Var Word
IntCount Var Word
Countenr Var Word
EI Var Word
Range con 100 'Intervalle de régulation en 1/10 °C
B con 50 'Centrage de régul ( +/- 50% )
Kp con 10
Ki con 2
Kd con 0
Ti con 24 '( *5 )
'*****************************************************************************
'Configs
'*****************************************************************************
ADCON1 = 7 ' Set PORTA and PORTE to digital
CMCON = 7 ' Comparators OFF
PORTA = %00000011 ' PortA.0 and1 are Button Controls
PORTB = 0
PORTC = 0
PORTD = 0
PORTE = 0
TRISA = %00000011
TRISB = 0
TRISC = 0
TRISD = 0
TRISE = %00000100 ' PortE.2 is DS sensor Input
Hi, Dave
+1 !!!
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks