Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

dspic33ep512mu814 sensing input without input

Status
Not open for further replies.

raman00084

Full Member level 6
Joined
Nov 29, 2010
Messages
362
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
4,006
hi friends i found a strange problem in dspic 33ep512mu814

Code:
if(input(pin_e0)==0)

{
count=count+1;
lcd_gotoxy(1, 1); 
printf(lcd_putc, "%lu",cont);
}
if i reset the controller manually in 4 are 5th time, the if loop condition is executing that is i am getting the count constantly without the pin input if i measure the voltage on pin e0 it is 3.3v, why this happening. kindly help  

the fuse setting are as follows
#include <33EP512MU814.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOCKSNOFSM               //Clock Switching is disabled, fail Safe clock monitor is disabled
//#FUSES CKSFSM                   //Clock Switching is enabled, fail Safe clock monitor is enabled
//#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOJTAG                   //JTAG disabled
#FUSES PUT128                 //Power On Reset Timer value 128ms

#device ICSP=1
#use delay(clock=96MHz,crystal=12MHz)

//#use i2c(MASTER, SCL=PIN_F5, SDA=PIN_F4, FAST, stream=I2C_PORT1)
#use i2c(MASTER, SCL=PIN_F5, SDA=PIN_F4, FAST)
#pin_select U1TX=PIN_G6
#pin_select U1RX=PIN_C4
#use rs232(UART1, baud=9600, stream=UART_PORT1)

#pin_select U2TX=PIN_G8
#pin_select U2RX=PIN_G7
#use rs232(UART2, baud=9600, stream=UART_PORT2)

#pin_select U3TX=PIN_D3
#pin_select U3RX=PIN_D12
#use rs232(UART3, baud=9600, stream=UART_PORT3)


#pin_select INT1=PIN_A3



regards
kalyan
 
Last edited by a moderator:

Is it possible that "input(pin_e0)" reads the LAT register, and the pin is 3.3volts but LAT is 0 ?
 
I have used that chip a lot but you have not told us anything that will really let us help you.
I assume that you are looking to read a digital signal on the PORTE bit 0. In the data sheet, that pin has the full name "AN24/PWM1L/RP80/RE0" where one of the key items is the "AN24".
That means the pin has the ability to provide an analog input. By default, all analog capable pins power on in analog mode. Read Section 11.2 in the data sheet to understand about analog and digital modes on pins.
In particular, there is the paragraph:
When the PORT register is read, all pins configured as
analog input channels are read as cleared (a low level).
This means that you can put whatever voltage you like on the pin, it will ALWAYS read as '0' while in analog mode.
Switch it to digital mode (you don't show us the code that does this so I assume you are not doing it).
(By the way, I assume you are running this in 'release' mode and not using the Microchip IDE debugger. There are other considerations you need to know when using the Microchip debugger that can impact on how the analog/digital settings work.)
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top