Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

16ff877 dificullty

Status
Not open for further replies.

echo_bry

New Member
hi there! is there some1 here who can help me with my problem with my 877 pic. my pic wasnt able to give me the correct output of high logic eventhough i had my PORTC and A in all bit set. what could be the problem with that?thanks
:( [/b]
 
echo_bry said:
hi there! is there some1 here who can help me with my problem with my 877 pic. my pic wasnt able to give me the correct output of high logic eventhough i had my PORTC and A in all bit set. what could be the problem with that?thanks
:( [/b]

Make sure you disable the A2D inputs, these are enabled by default and make ports A and E inputs. The 877A also has comparators (but I don't know which port they use), these are possibly also enabled by default.

Failing that, post the code so we can look!.
 
thanks

hey there thanks for the help...really appreciate it, can i send my code later to you? and another thing, have you heard of the MAXIM 114 an ADC chip(8bits)...coz im trying to interfaced it with my pic using its outputs as my input for my pic..PORTB will be my input from ADC!
 
No need to use an external ADC, there is a built in ADC 8bit (or 10 bit) in the 16F877... you just need to apply your analog volatage straight to the PIC and set ADCON registers, and tell it to do the conversion.

It is easly done... and you don't waste I/O, and time comunicating to a ADC converter.

Ivancho
 
adc difficulty

hi there ivancho, nweiz thanks for the reply.... the reason why we used an external ADC is that i dont know how to make use of the ADC in the PIC and it will cost us much time..can you show me an example of it?
:D
 
Re: adc difficulty

echo_bry said:
hi there ivancho, nweiz thanks for the reply.... the reason why we used an external ADC is that i dont know how to make use of the ADC in the PIC and it will cost us much time..can you show me an example of it?
:D

It's really easy, far easier than using an external one - full details are in the datasheet.

This code section reads the A2D and saves the 10 bit result in Var2 and Var2+1.

Code:
; Start(ADC)
    BSF      ADCON0, ADON
    BSF      ADCON0, GO_DONE
    BTFSC    ADCON0, GO_DONE
    GOTO     $-1
; A=ADC_Result
    MOVF     ADRESH,W
    ANDLW    0x03
    MOVWF    Acc1H
    BANKSEL  ADRESL
    MOVF     ADRESL,W
    BANKSEL  ADRESH
    MOVWF    VAR2
    MOVF     Acc1H, W
    MOVWF    VAR2+1

You also need to set it up first, but again, it's all explained in the datasheet.
 
adc

wut if i need to compare my inputs by subtracting them : new - previous, then ill check its carry if it is 1 or 0.....can it comprehend with the speed of my sensor which will have its output in just 5 seconds?
 
Re: adc

echo_bry said:
wut if i need to compare my inputs by subtracting them : new - previous, then ill check its carry if it is 1 or 0.....can it comprehend with the speed of my sensor which will have its output in just 5 seconds?

Yes, no problem - a 16 bit subtraction can be done pretty fast, using a 20MHz crystal a 16F877 can perform 5 instructions in 1uS, that's 5,000,000 instructions per second.

Depending on the resolution you need, and how you set the A2D up, you can use it as an 8 bit A2D, this way you only need to do an 8 bit compare.

But if you're talking about 5 seconds - that's an absolute age in PIC terms, most PIC's spend the vast majority of their life in loops wasting time!.
 
code for our thesis

sir my problem is how can i give my source code an overhaul by not not using the whole PORTBas my input and use only one pin from PORTE as my input...CAN YOU HELP ME WITH MY ADC IN THE PIC?thank you very much sir :D
 
Re: code for our thesis

echo_bry said:
sir my problem is how can i give my source code an overhaul by not not using the whole PORTBas my input and use only one pin from PORTE as my input...CAN YOU HELP ME WITH MY ADC IN THE PIC?thank you very much sir :D

I don't really understand the question?.

For an analogue input, it only uses one input pin - you can select which one it uses by writing to a register. The 16F877 only has one A2D, this is switched to the different input pins by the value in the register.

What are you actually wanting to do?.
 
sir my problem is how can i give my source code an overhaul by not not using the whole PORTBas my input and use only one pin from PORTE as my input...CAN YOU HELP ME WITH MY ADC IN THE PIC?thank you very much sir

Which ones are digital inputs and which ones are used as ADC inputs?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top