Searching \ for '[PIC]: output from ADRES register using PIC12C672' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=output
Search entire site for: 'output from ADRES register using PIC12C672'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: output from ADRES register using PIC12C672'
2000\07\13@125708 by Matt Willman

flavicon
face
I've had no experience with PIC's before, but I am trying to use a PIC12C672
to do A/D conversions.  My problem is that I'm unsure of how to set up the I/O
pins so that I can tranfer the results from the ADRES register to them.  I am
only using 1 pin for an analog input (CH0) and I think my code is correct so
far.  I just need some kind of a detailed example of how I should output my
results.  I've looked in the data sheets, but that really doesn't help a first
time user, who has never programmed in assembly before.

Thanks,
Matt Willman

____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\07\13@130654 by James Paul

flavicon
face
Matt,

Not trying to be sarchastic, but why do you want to take in an
analog voltage, convert it to a digital word (byte), and then
send it right back out of the processor?  If that's what you
need, just get a standalone A/D, and go from there.

From my point of view, the whole point of having an A/D on board
is to be able to sample an analog signal, convert it to digital,
then use that result inside the uC to be able to make decisions
on what to do next, such as turn on or off an output to control
a lamp for instance.

And if you're bent on getting the digital word out of the processor,
you'll either have to take it 4 bits at a time or do it serially.
The reason being you only have 6 'Input' pins and 5 'Output' pins,
so naturally, you can't send 8 bits out of a 5 bit port.

                                          Regards,

                                            Jim




On Thu, 13 July 2000, Matt Willman wrote:

{Quote hidden}

spam_OUTjimTakeThisOuTspamjpes.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\07\13@225453 by James Cameron

flavicon
face
Somehow getting the analog value into digital form for me to look at
would definitely be something I'd do during testing.

This chip is an eight pin device, isn't it?  You could put a few of the
bits of the value onto some of the output pins.  You could clock it out
as serial.

--
James Cameron    .....quozlKILLspamspam@spam@us.netrek.org     http://quozl.netrek.org/

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\07\14@002856 by Tony Nixon

flavicon
picon face
Matt Willman wrote:
>
> I've had no experience with PIC's before, but I am trying to use a PIC12C672
> to do A/D conversions.  My problem is that I'm unsure of how to set up the I/O
> pins so that I can tranfer the results from the ADRES register to them.  I am
> only using 1 pin for an analog input (CH0) and I think my code is correct so
> far.  I just need some kind of a detailed example of how I should output my
> results.  I've looked in the data sheets, but that really doesn't help a first
> time user, who has never programmed in assembly before.
>
> Thanks,
> Matt Willman

These simple serial routines may help.
19200 baud Fosc = 4MHz

Receive can be polled or interrupt driven.

;
; ----------------
; TRANSMIT ROUTINE
; ----------------
;
TxRoutine       movwf TxSend            ; temp store data to be sent
       bcf PORT,TX             ; do start bit
       call HBDelay5
       call HBDelay2
;
       movlw 8h                        ; 8 data bits to send
       movwf BCount
;
TxLoop  rrf TxSend
       btfsc STATUS,C
       goto TxHiBit
;
       nop
       bcf PORT,TX
       goto DoneBit
;
TxHiBit bsf PORT,TX
       goto $ + 1
;
DoneBit call HBDelay5           ; wait 1 bit length
       call HBDelay5
       decfsz BCount
       goto TxLoop
;
       call DoRet
       nop
       bsf PORT,TX             ; stop bit
       call HBDelay1
       call HBDelay
DoRet   return

;
;
; ---------------
; RECEIVE ROUTINE
; ---------------
;
RxRoutine       bcf flag1,data
       btfsc PORT,RX           ; wait for start bit
       return
;
       call HBDelay2           ; wait 1/2 bit length - 2 cycles
       movlw 9h
       movwf BCount
;
RxLoop  btfsc PORT,RX           ; start bit is lost during routine
       goto RxHiBit
;
       bcf STATUS,C            ; receive start bit and 8 data bits
       goto RxLoBit
;
RxHiBit bsf STATUS,C
       nop
RxLoBit rrf RxHold
       call HBDelay4           ; wait 1/2 bit length - 4 cycles
       call HBDelay5           ; wait 1/2 bit length - 5 cycles
       decfsz BCount
       goto RxLoop
;
       movf RxHold,W
       bsf flag1,data
       return                  ; data returned in W Reg
;
; --------------
; HALF BIT DELAY
; --------------
;
HBDelay nop
HBDelay1        nop
HBDelay2        goto $ + 1
HBDelay4        nop
HBDelay5        movlw 0x05
       movwf BitWait
BW      decfsz BitWait
       goto BW
       nop
       return




--
Best regards

Tony

mICro's
http://www.picnpoke.com
salesspamKILLspampicnpoke.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2000\07\14@010200 by Quentin
flavicon
face
Before the days of ICD, I used this routine to show a register on my
'scope. Connect the synch to channelA use this channel as trigger. The
short "1" in the output string is markers between bits. This was with
4MHz. If you want slower on scope, use delay routines instead of NOPs.

Quentin

;USE PORTA, 2 AND 3

;CODE EXAMPLE
           BSF         PORTA,2     ;SYNCH PULSE
           NOP
           NOP
           NOP
           BCF         PORTA,2
           MOVF        SMHI,W       ;register to test
           MOVWF       TEMP
           CALL        TEREG

;SUBS
TEREG       BSF         PORTA,3
;STRING:101XXX1XXX1XXX1XXX1XXX1XXX1XXX1XXX
           NOP
           BCF         PORTA,3
           MOVLW       0X08
           MOVWF       TEMP1
TST         NOP
           BSF         PORTA,3
           NOP
           BCF         PORTA,3
           BTFSS       TEMP,7
           GOTO        BITOUT
           BSF         PORTA,3
BITOUT      BCF         STATUS,C
           RLF         TEMP,F
           NOP
           NOP
           NOP
           NOP
           NOP
           NOP
           BCF         PORTA,3
           DECFSZ      TEMP1,F
           GOTO        TST
           RETLW       0

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...