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 CCS Technical Support

Dspic33FJ256GP710, digital input port B problem

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



Joined: 22 Apr 2009
Posts: 2

View user's profile Send private message

Dspic33FJ256GP710, digital input port B problem
PostPosted: Wed Apr 22, 2009 8:20 pm     Reply with quote

In the previous testing with Dspic33FJ256GP710, I try to get digital inputs from all the ports and display the results through uart. As a results, I got all the available inputs except from port B. I had tried many methods but just failed. Is there any suggestion on this?

The code is shown as below:
Code:

#include "33FJ256GP710.H"

#FUSES  FRC_PLL,NOCKSFSM,NOOSCIO,NOPR,NOWDT
#byte   TRISG = 0x02E4
#byte   TRISF = 0x02DE
#byte   TRISE = 0x02D8
#byte   TRISD = 0x02D2
#byte   TRISC = 0x02CC
#byte   TRISB = 0x02C6
#byte   TRISA = 0x02C0

#use    standard_io(a)
#use    standard_io(b)
#use    standard_io(c)
#use    standard_io(d)
#use    standard_io(e)
#use    standard_io(f)
#use    standard_io(g)
#use    delay(clock=40000000)
#use    rs232 (baud=2400, xmit=PIN_F5, rcv=PIN_F4, parity=N, bits=8, stream=LCONF)

void set_io(void){
   int16 value;

   set_tris_a(0xffff);
   set_tris_b(0xffff);
   set_tris_c(0xffff);
   set_tris_d(0xffff);
   set_tris_e(0xffff);
//    set_tris_f(0xffff);
   set_tris_g(0xffff);

    bit_clear (TRISF, 5);        //LCONF TX
    bit_set   (TRISF, 4);        //LCONF RX

   fprintf(LCONF,"Check Port Status...\n");
   value = get_tris_A();
   fprintf(LCONF,"PortA: %lu\n ...",value);
   value = get_tris_B();
   fprintf(LCONF,"PortB: %lu\n ...",value);
   value = get_tris_C();
   fprintf(LCONF,"PortC: %lu\n ...",value);
   value = get_tris_D();
   fprintf(LCONF,"PortD: %lu\n ...",value);
   value = get_tris_E();
   fprintf(LCONF,"PortE: %lu\n ...",value);
   value = get_tris_F();
   fprintf(LCONF,"PortF: %lu\n ...",value);
   value = get_tris_G();
   fprintf(LCONF,"PortG: %lu\n ...",value);
}

#zero_ram
void main(void){
   delay_ms(5000);
   delay_ms(5000);

   fprintf(LCONF,"Initialization. Please Wait...\n");
    disable_interrupts(INTR_GLOBAL);
   setup_oscillator(OSC_INTERNAL,40000000);
   set_io();
   enable_interrupts(INTR_NORMAL);                  //Enable global intrp
   fprintf(LCONF,"Done...Start Up...\n");

   while(1){
       int16 data;

       data = input_a();
       printf("DataA: %lu\n",data);
       data = input_b();
       printf("DataB: %lu\n",data);
       data = input_c();
       printf("DataC: %lu\n",data);
       data = input_d();
       printf("DataD: %lu\n",data);
       data = input_e();
       printf("DataE: %lu\n",data);
       data = input_f();
       printf("DataF: %lu\n",data);
       data = input_g();
       printf("DataG: %lu\n",data);

       delay_ms(2000);
   }
}

Is there any other configurations that I need to set? Please kindly advise. Thanks.
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