Jump to content


Photo

Plugin Don't Work Correctly


3 replies to this topic

#1 kf00115

kf00115

    Newbrie

  • EstablishedMember
  • 7 posts

Posted 02 November 2012 - 07:05 PM

If i do: set_bit(porta,0) ,set_bit(porta,1) ,.....set_bit(porta,5) in debug mode with led block (8), leds fro 0 to 5 work correctly

If i do set_bit(porta,6) or set:bit(porta,7) led 6 and 7 of leds block (8 leds) plugin dont' go ON


#include <system.h>
#include <boostC.h>

.............
......................
void main( void )

{
//Configure port A OUT
trisa = 0x00;

set_bit(porta,0); turn ON LED 0
set_bit(porta,1); turn ON LED 1
set_bit(porta,2); turn ON LED 2
set_bit(porta,3); turn ON LED 3
set_bit(porta,4); turn ON LED 4
set_bit(porta,5); turn ON LED 5

set_bit(porta,6); nothing on LED 6
set_bit(porta,7); nothing on LED 7

where is then problem?

#2 JorgeF

JorgeF

    Super Enthusiast

  • EstablishedMember
  • PipPipPip
  • 274 posts
  • Gender:Male
  • Location:ES @ Europe, third rock from the Sun

Posted 03 November 2012 - 10:53 PM

Hi

What target device?
Are you sure that there are no analog functions active that might be overriding your I/O settings?


Best egards
Jorge

#3 kf00115

kf00115

    Newbrie

  • EstablishedMember
  • 7 posts

Posted 04 November 2012 - 11:00 AM

Good morning,

Pic16F876
i think i have no analog functions

Thanks Paul

#4 JorgeF

JorgeF

    Super Enthusiast

  • EstablishedMember
  • PipPipPip
  • 274 posts
  • Gender:Male
  • Location:ES @ Europe, third rock from the Sun

Posted 05 November 2012 - 12:26 PM

Hi

Pic16F876
i think i have no analog functions

Maybe you don't, at least the kind we are discussing here, but the PIC certainly has. :unsure:

All of PORTA bits have AN functions.
This functions must be disabled before you use the PORTA pins as digital. HINT: Look for ADCON or ANSEL registers in your datasheet.

Also PORTA pins have lots of alternate functions, including clock related, so you beter take care of a full configuration of the PIC (CONFIGURATION WORDS) before trying to test anything.
As a matter of fact I would use any other port. As a rule of thumb for PICs, PORTA is the least suitable for this kind of quick test because of its multiple functions.
Usually the best port is the one with the higgest designator, that is allways the one with the simplest internal hardware, hence the simplest to configure.

Best regards
Jorge

Edited by JorgeF, 05 November 2012 - 12:27 PM.




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users