![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| 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 | |
| |
| | (permalink) | |
| Quote:
Failing that, post the code so we can look!. | ||
| |
| | (permalink) |
| 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! | |
| |
| | (permalink) |
| 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 | |
| |
| | (permalink) |
| 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? | |
| |
| | (permalink) | |
| Quote:
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 | ||
| |
| | (permalink) |
| 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? | |
| |
| | (permalink) | |
| Quote:
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!. | ||
| |
| | (permalink) |
| 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 | |
| |
| | (permalink) | |
| Quote:
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?. | ||
| |
| | (permalink) | |
| Quote:
__________________ "Having to do with Motion Control" | ||
| |