Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 5th February 2004, 07:15 PM   (permalink)
Default 16ff877 dificullty

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 is offline  
Old 5th February 2004, 07:43 PM   (permalink)
Default Re: 16ff877 dificullty

Quote:
Originally Posted by echo_bry
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!.
Nigel Goodwin is offline  
Old 5th February 2004, 07:50 PM   (permalink)
Default 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!
echo_bry is offline  
Old 5th February 2004, 08:01 PM   (permalink)
Default

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
ivancho is offline  
Old 9th February 2004, 11:32 AM   (permalink)
Default 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?
echo_bry is offline  
Old 9th February 2004, 11:39 AM   (permalink)
Default Re: adc difficulty

Quote:
Originally Posted by echo_bry
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?
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.
Nigel Goodwin is offline  
Old 9th February 2004, 11:45 AM   (permalink)
Default 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?
echo_bry is offline  
Old 9th February 2004, 12:19 PM   (permalink)
Default Re: adc

Quote:
Originally Posted by echo_bry
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!.
Nigel Goodwin is offline  
Old 9th February 2004, 04:36 PM   (permalink)
Default 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
echo_bry is offline  
Old 9th February 2004, 10:33 PM   (permalink)
Default Re: code for our thesis

Quote:
Originally Posted by echo_bry
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
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?.
Nigel Goodwin is offline  
Old 10th February 2004, 12:00 AM   (permalink)
Default

Quote:
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?
__________________
"Having to do with Motion Control"
motion is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 05:46 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker