PDA

View Full Version : pic16f886



NURULHAIZA
- 19th May 2010, 15:06
hi,
i would like to ask if anyone hv use pic16f886...i do have problem dealing with port A and B..is there any configuration that i need to for this 2 ports?
thanks;)

HenrikOlsson
- 19th May 2010, 16:11
Hi,
I've never used it but that chip has analog functions (ADC and comparator inputs) across both PortA and PortB.... You're not saying what the problem you're having IS but a wild guess is you're not using them for analog inputs, yet you haven't configured them to be digital I/O's.

See the ADC and comparator section in the datasheet.

/Henrik.

NURULHAIZA
- 20th May 2010, 01:42
the problem is that when i connect a switch at port A&B it's not working....but when i connect the switch at port C it's OK....i'll the datasheet again...thanks for the info....:)

ardhuru
- 20th May 2010, 06:09
As Henrik pointed out, its most likely because you havent disabled the ADCs and the comparators. If you dont need them, perhaps the easiest way to do it in one stroke is to use DT's Alldigital.pbp as an include. Check this thread:

http://www.picbasic.co.uk/forum/showthread.php?t=11100

Should solve your problem.

Regards,

Anand

NURULHAIZA
- 21st May 2010, 01:48
tq for the idea....i would like to ask any of you to check my code...it seems like noting wrong but when the m=1 suppose that there is something display...but notting happens accept for OK that been send by XBEE....
@ DEVICE HS_OSC
define OSC 20
DEFINE HSER_BAUD 9600
DEFINE HSER_TXSTA 24h
DEFINE HSER_SPBRG 129
ANSEL = 0 'All Digital, konfigurasi ini utk jadikan semua port
ANSELH = 0 'digital utk high, low, serin/out, if.
'DEFINE OSC 8
'OSCCON = %01110001
dta1 var word
LED var PORTb.0
m var PORTb.1
bilangan var byte

main1:low LED
if m = 1 then main
serout2 portb.2, 16468,["SELAMAT DATANG KE CEDEC...:",34,13,26]
pause 200
goto main1

main: high LED : pause 300
hserout ["+++"]
'hserout ["+"] Pause 50:hserout ["+"]Pause 50:hserout ["+"]
hserin 2000,main1,[dta1(0),dta1(1)]

'For bilangan = 0 to 2
'HSerIn 2000,main1,[dta1(bilangan)]
'Next bilangan
'hserin 3000, main1,[wait("OK"),dta1]
serout2 portb.2, 16468,[dta1(0), dta1(1)]
pause 2000
in : if m = 1 then main1
hserout ["ATID 100"]: pause 50:hserout [26]
'hserout ["ATID",26] : pause 200: hserout [26,13] ause 500
'For bilangan = 0 to 2
hserin 2000, in,[dta1(0),dta1(1),dta1(2)]:pause 200
serout2 portb.2, 16468,[dec dta1(0),dec dta1(1),dec dta1(2)]
low LED : Pause 200
goto main1

thanks :D

NURULHAIZA
- 21st May 2010, 08:09
hi guys...
as the above title clearly state...i would like to how to read AT command from XBEE using picbasic....thanks...
;)