CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PCD problems on reading port_B .. HELP PLEASE!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ik1wvq



Joined: 21 Feb 2004
Posts: 20

View user's profile Send private message

PCD problems on reading port_B .. HELP PLEASE!
PostPosted: Mon Sep 15, 2008 6:18 am     Reply with quote

Hi,

PCD 4.079
3FJ128GP706
PROBLEM:
I try to read the PORTB ( whole with "input_b()" or single pin with "input(pin_rb11) ")
The results is all zeroes.
This my trivial program:

Code:

#include <33FJ128GP706.h>
#type unsigned

#Fuses NOWRTB,NOBSS,NOPROTECT
#Fuses NOWRT,PR_PLL,XT,NOCKSFSM
#Fuses NOOSCIO,NOWDT,NOWINDIS,WPRES128
#Fuses PUT128
#Fuses NODEBUG,NOCOE,NOJTAG

#define  LED_ROSSO PIN_B10

#word PLLFBD=0x746
#word CLKDIV=0x744

#use delay(clock=77414400, restart_wdt)
#use rs232(BRGH1oK,baud=9600,UART2, ERRORS,RESTART_WDT)

void main(void)
{
        PLLFBD=84;                      // M=75
        CLKDIV=0b0000000000000000;      // N1=2  N2=2
        delay_ms(50);
        output_high(LED_ROSSO);
       
        gira:
        restart_wdt();
        delay_ms(100);
        printf("\rRB->%lX  - ",input_b());
        printf("RG->%lX  - ",input_g());
        printf("RF->%lX",input_f());   
        output_toggle(LED_ROSSO);
        goto gira;
}

The OUTPUT is:
"RB->0000 - RG->010E - RF->005E"
RG and RF follow the state of the inputs, RB is ALWAYS ZERO ..

What happens ???
Thanks in advance
Regards

Mauro
glap
Guest







PostPosted: Mon Sep 15, 2008 7:39 am     Reply with quote

Try to set the input port in digital mode (setup_adc_ports).
Bye
Gaetano
Guest








PostPosted: Tue Sep 16, 2008 1:36 am     Reply with quote

thanks anyway , but still dont work ..

ragards
ik1wvq



Joined: 21 Feb 2004
Posts: 20

View user's profile Send private message

PostPosted: Tue Sep 16, 2008 1:38 am     Reply with quote

thanks anyway , but still dont work ..

ragards
ik1wvq



Joined: 21 Feb 2004
Posts: 20

View user's profile Send private message

PostPosted: Fri Sep 19, 2008 3:50 am     Reply with quote

Hi,
I found myself the solution!

The chip 33FJ128GP706 has TWO analog_to_digital modules, and then, we MUST declare:

setup_adc_ports(no_analogs); // useless, because the compiler produces itself the relative code
setup_adc_ports2(NO_ANALOGS); // this line mandatory

Putting this lines the portb work fine!

I write this to CCS:
....
This matter (two analog modules) is unclear in the microchip manual, and also in your manual.
Please explain this problem to all other developers.
I found this by ten trials.


Mauro
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group