Hi Steve,
Sorry for not getting back to you sooner but I got real busy at work the last few days and just got some time to reply. Below is listed all my config, defines and tris settings. I read this in the data sheet for the 18f452 but I don't understand what I'm reading. Maybe if you have the time you could explain what I need to do.
RE2/CS/AN7
PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6
and RE2/CS/AN7) which are individually configurable
as inputs or outputs. These pins have Schmitt Trigger
input buffers.
The PORTE pins become the I/O control inputs for the
microprocessor port when bit PSPMODE (TRISE<4>) is
set. In this mode, the user must make certain that the
TRISE<2:0> bits are set and that the pins are configured
as digital inputs. Also, ensure that ADCON1 is configured
for digital I/O. In this mode, the input buffers are
TTL.
Register 4-1 shows the TRISE register which also
controls the Parallel Slave Port operation.
PORTE pins are multiplexed with analog inputs. When
selected for analog input, these pins will read as ‘0’s.
TRISE controls the direction of the RE pins, even when
they are being used as analog inputs. The user must
make sure to keep the pins configured as inputs when
using them as analog inputs.
Thanks
jessey
Code:-------------- | 18F452 | MCLR/Vpp ------> |1 40| <-----> RB7/PGD RA0/AN0 <-----> |2 39| <-----> RB6/PGC RA1/AN1 <-----> |3 38| <-----> RB5/PGM RA2/AN2/Vref- <-----> |4 37| <-----> RB4 RA3/AN3/Vref+ <-----> |5 36| <-----> RB3/CCP2* RA4/TOCK1 <-----> |6 35| <-----> RB2/INT2 RA5/AN5/SS/LVDIN <-----> |7 34| <-----> RB1/INT1 RE0/RD/AN5 <-----> |8 33| <-----> RB0/INT0 RE1/WR/AN6 <-----> |9 32| <----- Vdd + RE2/CS/AN7 <-----> |10 31| <----- Vss - + Vdd -----> |11 30| <-----> RD7/PSP7 _ VSS -----> |12 29| <-----> RD6/PSP6 OSC1/CLK1 -----> |13 28| <-----> RD5/PSP5 OSC2/CLKO/RA6 <------ |14 27| <-----> RD4/PSP4 RC0/T1OSO/TICK1 <-----> |15 26| <-----> RC7/RX/DT RC1/T1OSI/CCP2* <-----> |16 25| <-----> RC6/TX/CK RC2/CPP1 <-----> |17 24| <-----> RC5/SDO RC3/SCK/SCL <-----> |18 23| <-----> RC4/SD1/SDA RD0/PSP0 <-----> |19 22| <-----> RD3/PSP3 RD1/PSP1 <-----> |20 21| <-----> RD2/PSP2 -------------- -------------- | 18F452 | MCLR |1 40| Water_Valve_1 Buzzer |2 39| Water_Valve_2 Up_Push_Button |3 38| Water_Valve_3 Down_Push_Button |4 37| Water_Valve_4 Instructions_Push_Button |5 36| Water_Valve_5 Select2_Push_Button |6 35| Water_Valve_6 Select_Push_Button |7 34| The_Main_Water_Valve Lcd |8 33| The_Nutrient_Pump Lcd |9 32| <----- Vdd + Need Digital Input here |10 31| <----- Vss - + Vdd -----> |11 30| Lcd - VSS -----> |12 29| Lcd OSC1 |13 28| Lcd OSC2 |14 27| Lcd Communications_Port_1 |15 26| Nutrient_Valve_1 Communications_Port_2 |16 25| Nutrient_Valve_2 Communications_Port_3 |17 24| Nutrient_Valve_3 Communications_Port_4 |18 23| Nutrient_Valve_4 Communications_Port_5 |19 22| Nutrient_Valve_5 Communications_Port_6 |20 21| Nutrient_Valve_6 -------------- '-------------------- PORTA PINS --------------------' TRISA.0 = 0 '(pin 2) ................ Buzzer TRISA.1 = 1 '(pin 3) ................ Up_Push_Button TRISA.2 = 1 '(pin 4) ................ Down_Push_Button TRISA.3 = 1 '(pin 5) ................ Instructions_Push_Button TRISA.4 = 1 '(pin 6) ................ Select2_Push_Button TRISA.5 = 1 '(pin 7) ................ Select_Push_Button '-------------------- PORTB PINS --------------------' TRISB.0 = 0 '(pin 33) ............... The_Nutrient_Pump TRISB.1 = 0 '(pin 34) ............... The_Main_Water_Valve TRISB.2 = 0 '(pin 35) ............... Water_Valve_6 TRISB.3 = 0 '(pin 36) ............... Water_Valve_5 TRISB.4 = 0 '(pin 37) ............... Water_Valve_4 TRISB.5 = 0 '(pin 38) ............... Water_Valve_3 TRISB.6 = 0 '(pin 39) ............... Water_Valve_2 TRISB.7 = 0 '(pin 40) ............... Water_Valve_1 '-------------------- PORTC PINS --------------------' TRISC.0 = 1 '(pin 15) ............... Communications_Port_1 TRISC.1 = 1 '(pin 16) ............... Communications_Port_2 TRISC.2 = 1 '(pin 17) ............... Communications_Port_3 TRISC.3 = 1 '(pin 18) ............... Communications_Port_4 TRISC.4 = 0 '(pin 23) ............... Nutrient_Valve_4 TRISC.5 = 0 '(pin 24) ............... Nutrient_Valve_3 TRISC.6 = 0 '(pin 25) ............... Nutrient_Valve_2 TRISC.7 = 0 '(pin 26) ............... Nutrient_Valve_1 '-------------------- PORTD PINS --------------------' TRISD.0 = 1 '(pin 19) ............... Communications_Port_5 TRISD.1 = 1 '(pin 20) ............... Communications_Port_6 TRISD.2 = 0 '(pin 21) ............... Nutrient_Valve_6 TRISD.3 = 0 '(pin 22) ............... Nutrient_Valve_5 TRISD.4 = 0 '(pin 27) ............... Lcd Data bit 4 TRISD.5 = 0 '(pin 28) ............... Lcd Data bit 5 TRISD.6 = 0 '(pin 29) ............... Lcd Data bit 6 TRISD.7 = 0 '(pin 30) ............... Lcd Data bit 7 '-------------------- PORTE PINS --------------------' TRISE.0 = 0 '(pin 8) ............... Lcd Register select TRISE.1 = 0 '(pin 9) ............... Lcd Enable TRISE.2 = 1 '(pin 10) ............... Need Digital Input here @ __CONFIG _CONFIG1H, _OSCS_ON_1H & _XT_OSC_1H @ __CONFIG _CONFIG2L, _BOR_OFF_2L & _BORV_20_2L & _PWRT_ON_2L @ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H @ __CONFIG _CONFIG3H, _CCP2MX_OFF_3H @ __CONFIG _CONFIG4L, _STVR_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L @ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L @ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H @ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L @ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_ON_6H @ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L @ __CONFIG _CONFIG7H, _EBTRB_OFF_7H DEFINE OSC 4 Define LCD_DREG PORTD Define LCD_DBIT 4 Define LCD_RSREG PORTE Define LCD_RSBIT 0 Define LCD_EREG PORTE Define LCD_EBIT 1 ADCON1 = 7 ' Sets portA & E outputs to Digital '-------------------------------------------' '----------- Configure Port Pins -----------' '-------------------------------------------' Up_Push_Button VAR PORTA.1 '(pin 3) Down_Push_Button VAR PORTA.2 '(pin 4) Instructions_Push_Button VAR PORTA.3 '(pin 5) Select_Push_Button VAR PORTA.5 '(pin 7) Select2_Push_Button VAR PORTA.4 '(pin 6) Buzzer VAR PORTA.0 '(pin 2) Need Digital Input Here VAR PORTE.1 '(pin 10) The_Nutrient_Pump VAR PORTB.0 '(pin 33) The_Main_Water_Valve VAR PORTB.1 '(pin 34) Water_Valve_1 VAR PORTB.7 '(pin 40) Water_Valve_2 VAR PORTB.6 '(pin 39) Water_Valve_3 VAR PORTB.5 '(pin 38) Water_Valve_4 VAR PORTB.4 '(pin 37) Water_Valve_5 VAR PORTB.3 '(pin 36) Water_Valve_6 VAR PORTB.2 '(pin 35) Communications_Port_1 VAR PORTC.0 '(pin 15) Communications_Port_2 VAR PORTC.1 '(pin 16) Communications_Port_3 VAR PORTC.2 '(pin 17) Communications_Port_4 VAR PORTC.3 '(pin 18) Communications_Port_5 VAR PORTD.0 '(pin 19) Communications_Port_6 VAR PORTD.1 '(pin 20) Nutrient_Valve_1 VAR PORTC.7 '(pin 26) Nutrient_Valve_2 VAR PORTC.6 '(pin 25) Nutrient_Valve_3 VAR PORTC.5 '(pin 24) Nutrient_Valve_4 VAR PORTC.4 '(pin 23) Nutrient_Valve_5 VAR PORTD.3 '(pin 22) Nutrient_Valve_6 VAR PORTD.2 '(pin 21) INCLUDE "EE_Vars.PBP"


once you're done, please post some of your code that show/use that nice feature... at very least for others forum member benefit.. and Darrel's pleasure.




Bookmarks