Interfacing keys to dsPIC

Status
Not open for further replies.

ITP

Advanced Member level 4
Joined
Jul 11, 2001
Messages
116
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
1,136
dspic fun

Hi all,

How can I interface Four keys to PortB of dsPIC30F2020 Micro.

I have some problem in configuring the port. My code is as follows.


ADPCFG = 0xffff; // all PORTB = Digital
TRISB = 0xffff; // port B input
CNEN1 = 0x00ff;
CNPU1=0x00ff;

I this I am not able to enable pullups on this port.

Please help me.

Regards
Itp
 

dspic seven segment

Why on earth would you be learning elementary PIC programming on such an advanced PIC?
 

Because there is very little info on the net about the 16bit PICs compared to the scads of info on the 8bit PICs. The dsPIC is very complex, lots of fun.
 

Hi All,

Thanks for your reply,

I have developed a module on this processor to generate a pulse of following spec.

Frequency : 1Hz to 100Khz ( user can vary)
Duty Cycle: 10% to 90% ( user can vary)

Also I have interfaced a Serial Seven segment LED display to this processor through SPI port.

But while interfacing Key board to PORTB I am facing some problem.

For time being I have used another port for this purpose and solved my problem.

Still I wish that If any experienced person can explain above problem.

I am using dsPIC30F2020-30I/SP with Mplab C30 + ICD2.


Thanks and regards
Itp
 

I' ve had the same problem with the dsPic33fj128mc706.
I' ve configured all analog inputs as digital I/O, and portB as input, but when I tried to read the B port it always returned zero. The strangest thing is when I write to the portB it looks like ok, but I can't read.

Someone knows what happen?8-O

---------- Post added at 13:59 ---------- Previous post was at 13:12 ----------

Problem solved!
In my case, the dsPic33fj128mc706 have two ADCs and both must be seted to digital I/O, like this:
AD1PCFGL = 0xFFFF;
AD2PCFGL = 0xFFFF;

That is it!
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…