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.

[SOLVED] Simple Pic18f4550 pin problem............

Status
Not open for further replies.

Praveen Kumar P S

Member level 4
Joined
Aug 21, 2014
Messages
79
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Location
India
Activity points
627
Hello Guys.....

i can set all pin on all port to high using the output_high(). but this function is not working for PIN_A6....it stays on low....somebody tell me why?

Here is my code...

Code:
#include <18f4550.h>
#device ADC=10
#fuses HS,NOWDT,NOPROTECT, BROWNOUT, NOLVP, PUT 
#use delay(crystal=48000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,ERRORS)
#include<flex_lcd416.c>
#define PIN PIN_A6

void main()
{
lcd_init();
for(;;)
{
lcd_gotoxy(1,1);
printf(lcd_putc,"Motor Start");
output_bit(PIN,1);
Delay_us(10);
}
}

THANK YOU
 

hi,
If I am reading your problem correctly.
When using an external crystal and HS, RA6 is a OSC pin.?

E
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
Is the circuit simulation or hardware?

Attach the circuit diagram.
 

hi,
If I am reading your problem correctly.
When using an external crystal and HS, RA6 is a OSC pin.?

E
Actually i m using a isis simulation...and i m not using any oscillator...................

thank you

- - - Updated - - -

- - - Updated - - -

Is the circuit simulation or hardware?

Attach the circuit diagram.

its a simulation.....



- - - Updated - - -

Can you replace "output_bit(PIN,1); " these by output_high(pin_A6)

i used output_high(pin_A6) still nno effect..............:-?
 

#use FIXED_IO( A_outputs=PIN_A6 ) add this line after ADC Initialize...

First you configure port pin was Input or output..
 

#use FIXED_IO( A_outputs=PIN_A6 ) add this line after ADC Initialize...

First you configure port pin was Input or output..

i did what u have said ...but no effect....when i used above code whole port A fail to output................:bang::bang::bang:

Any Idea....Thank you
 

PIN_A6 is 10th pin of PIC18F4550. Where pin 9 and 10 are used to connect crystal on that pin.

If you want to drive output on pin A6. You have to use internal oscillator rather than high speed crystal.

try this code.

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <18f4550.h>
#device ADC=10
#fuses INTRC_IO,NOWDT,NOPROTECT, BROWNOUT, NOLVP, PUT    // INTRC_IO -  internal oscillator with pins 9 and 10 //used for input/output
#use delay(crystal=4000000)    // 4Mhz 
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,ERRORS)
#include<flex_lcd416.c>
#define PIN PIN_A6
 
void main()
{
lcd_init();
for(;;)
{
lcd_gotoxy(1,1);
printf(lcd_putc,"Motor Start");
output_high(PIN);
Delay_us(10);
}
}

Hope this help :)
 
Last edited by a moderator:
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
If you want to drive output on pin A6. You have to use internal oscillator rather than high speed crystal.

Simply wrong.

It's the other way round. If you are not enabling the low frequency oscillator 2, RA6 is available as general purpose pin. There's no cause in the post #1 code that stops RA6 from working as GPIO with output function. The code in flex_lcd416.c would normally not configure RA6, but we can't check it.

So it might be another Proteus bug. You can debug code execution in Proteus if you want to know what's going on.
 

Simply wrong.

It's the other way round. If you are not enabling the low frequency oscillator 2, RA6 is available as general purpose pin. There's no cause in the post #1 code that stops RA6 from working as GPIO with output function. The code in flex_lcd416.c would normally not configure RA6, but we can't check it.

So it might be another Proteus bug. You can debug code execution in Proteus if you want to know what's going on.

No Port A pins are used in fluxlcd416.h......This is the o/p when all the port_A pins are enabled....

pin_A6 is giving Zero and PIN_A4 is giving nothing..........:bang::bang::bang:



- - - Updated - - -

The datasheet says that the RA4 pin is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The RA6 pin is multiplexed with the main oscillator pin; it is enabled as an oscillator or I/O pin by the selection of the main oscillator in Configuration Register 1H......Actually i didnt understand it quite well.....plz some explain ihow to config 1H register.....


Thank You...
 

Please Zip and post the full CCS C project files and Proteus file.
 

The datasheet says that the RA4 pin is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The RA6 pin is multiplexed with the main oscillator pin; it is enabled as an oscillator or I/O pin by the selection of the main oscillator in Configuration Register 1H......Actually i didnt understand it quite well.....plz some explain ihow to config 1H register.....

hi,
Look at the lower half of this Microchip 18F4550.txt file for CONFIG 1H options.
NOTE: the file extension changed to .txt from .inc to enable download.

E
 

Attachments

  • P18F4550.txt
    55.9 KB · Views: 92

The datasheet says that the RA4 pin is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The RA6 pin is multiplexed with the main oscillator pin; it is enabled as an oscillator or I/O pin by the selection of the main oscillator in Configuration Register 1H......Actually i didnt understand it quite well.....plz some explain ihow to config 1H register.....

Yes, that's right. The problem is that you selected HS oscillator option although you are using internal oscillator.

I apologize for my previous answer to hemnath's post. He already recognized the problem.
 

Yes, that's right. The problem is that you selected HS oscillator option although you are using internal oscillator.

I apologize for my previous answer to hemnath's post. He already recognized the problem.

hi fvm,
As did I, in my post #2.
Eric
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top