part 1 1085 bytes content-type:text/plain; format=flowed; charset=us-ascii (decoded 7bit)
See attached...
Vic Lopez wrote:
{Quote hidden}> Dear Picsters,
> Would be so kind as to point to any examples for the PIC12C508A or
> any tutorials. Thanks and best regards. Vic Lopez
>
>
>
>
> *********************************
> Get your free E-Mail and Homepage
> Go to
http://www.networld.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
>
>
>
>
Nino
--
------------------------------------------------------
| Antonio (Nino) L. Benci |
| Professional Officer, Electronic Services |
| School of Physics & Materials Engineering |
| Monash University |
| email: spam_OUTelectronic.servicesTakeThisOuT
spme.monash.edu.au |
| T: 61 3 9905 3649. F: 61 3 9905 3637 |
| M: 0414 924 833 |
------------------------------------------------------
part 2 4948 bytes content-type:text/plain; name=noise509.asm
(decoded 7bit)
;
; Pseudorandom digital white noise generator for PIC series.
;
; PIC12C508 version written April 7th, 1997 by Scott Rider.
; Questions/comment to .....chipKILLspam
@spam@aeug.org
;
; PIC12C509 modified version by Antonio L. Benci. 22/03/1999.
;
; This program uses Microchip assembler mnemonics and the Microchip
; MPASM assembler (http://www.microchip.com/). Default config options
; are set in the __FUSES line below: MCLRE off, CP off, WDT off, OSC=INTRC.
;
; _______ _______
; | \/ |
; (+5V) Vdd --+ 1 8 +-- Vss (GND)
; | | 470
; X1/CLKI/GP5 --+ 2 7 +-- GP0 (audio out) --/\/\/-- (spkr)
; (not used) | | | 10K 1uF
; X2/CLKO/GP4 --+ 3 6 +-- GP1 --/\/\/--|(-- (line)
; (swt input) | | (swt input)
; GP3/!MCLR --+ 4 5 +-- GP2
; (swt input) | (PIC12C508) | (swt input)
; +----------------+
;
; This program generates a continuous stream of white noise through a
; speaker connected (via a 470-ohm series resistor) to pin GP0 of a
; PIC12C509. It demonstrates an easy method for generating a seemingly
; random stream of bits. Hardware folks will probably recognize it as the
; tapped shift register technique covered in the CMOS Cookbook by Don
; Lancaster.
;
; Adapted from the original PIC16C54 (Parallax) version by Scott Edwards.
;
;##########################################################################
;
; Programmable noise weighting added by A L Benci 22/03/1999
;
; GP1..GP4 are connected to a dip switch which the user can use to select
; 'textures' of 2 to 30. A zero value skips the function.
;
;
list p=12c509
radix dec
include "p12c509.inc"
__FUSES _MCLRE_OFF &_CP_OFF & _WDT_OFF & _IntRC_OSC ;Internal osc.
cblock 0x07 ;Variables
i ;Loop counter
x ;Scratch
y ;Scratch
zz ;Scratch
sr0 ;32 bits of shift register
sr1
sr2
sr3 ;/
endc
org 0x0
;
; PIC12C509 cold starts at 03FFF (where it loads a factory-programmed
; internal osc. calibrate value). It then rolls over to 0x0.
;
movwf OSCCAL
goto start
;
; Subroutines in 12-bit PIC series must go on bottom page of ROM.
;
wait
loop decfsz i,F
goto loop
retlw 0
;
; Main code area traditionally starts at 0x100 on a 12-bit PIC.
;
org 0x100
start movlw b'11000000' ;Turn off T0CKI
option ;/
movlw b'00000000' ;Preset outputs to come up low
movwf GPIO ;/
movlw b'00011110' ;Set the I/O direction (GP3..GP1 as inputs, GP0,GP5 as output)
tris GPIO
clrf sr0 ;Might as well start with a seed of zero.
clrf sr1
clrf sr2
clrf sr3 ;/
;
; The main loop 'taps' is 24 CPU cycles. At the 4MHz internal clock
; rate, the noise output is operating at a max. rate of about 21KHz.
;
taps btfss sr3,6 ;Get bits 28 and 31 for the feedback XOR.
bcf x,0
btfsc sr3,6
bsf x,0 ;Bit 31 -> x
btfss sr3,3
bcf y,0
btfsc sr3,3
bsf y,0 ;Bit 28 -> y
movf y,W ;!(x XOR y) -> carry
xorwf x,F
btfsc x,0
bcf STATUS,C
btfss x,0
bsf STATUS,C ;/
rlf sr0,F ;32-bit shift
rlf sr1,F
rlf sr2,F
rlf sr3,F ;/
;
; Put a pseudorandom bit out to the speaker. In this example, GPIO bit 0
; (pin 7 on the PIC12C509) is used. Be sure to use a 470 ohm resistor for
; speaker or 10K or better for input to an op-amp/divider/whatever.
;
; Also, to use all six GP bits for noise, just comment the following 4
; lines and uncomment the 5th and 6th lines.
;
btfss sr3,7 ;line 1
bcf GPIO,0 ;line 2
btfsc sr3,7 ;line 3
bsf GPIO,0 ;line 4
; movf sr3,W ;line 5
; movwf GPIO ;line 6
;
; Uncomment the following 'call wait' to experiment with changing the
; 'texture' of the noise (see 'wait' routine, above).
movf GPIO,W ;read switch input
andlw b'00011110' ;mask all but swt bits
movwf i ;save value
btfss STATUS,Z ;is result zero
; call wait ;Optional delay routine to alter sound
goto taps ;Ad infinitum...
;
; That's all, folks!
;
end
part 3 4473 bytes content-type:text/plain; name=noise508.asm
(decoded 7bit)
;
; Pseudorandom digital white noise generator for PIC series.
;
; PIC12C508 version written April 7th, 1997 by Scott Rider.
; Questions/comment to chip
KILLspamaeug.org
;
; This program uses Microchip assembler mnemonics and the Microchip
; MPASM assembler (http://www.microchip.com/). Default config options
; are set in the __FUSES line below: MCLRE off, CP off, WDT off, OSC=INTRC.
;
; _______ _______
; | \/ |
; (+5V) Vdd --+ 1 8 +-- Vss (GND)
; | | 470
; X1/CLKI/GP5 --+ 2 7 +-- GP0 (audio out) --/\/\/-- (spkr)
; (not used) | | | 10K 1uF
; X2/CLKO/GP4 --+ 3 6 +-- GP1 --/\/\/--|(-- (line)
; (not used) | | (not used)
; GP3/!MCLR --+ 4 5 +-- GP2
; (not used) | (PIC12C508) | (not used)
; +----------------+
;
; This program generates a continuous stream of white noise through a
; speaker connected (via a 470-ohm series resistor) to pin GP0 of a
; PIC12C508. It demonstrates an easy method for generating a seemingly
; random stream of bits. Hardware folks will probably recognize it as the
; tapped shift register technique covered in the CMOS Cookbook by Don
; Lancaster.
;
; Adapted from the original PIC16C54 (Parallax) version by Scott Edwards.
;
list p=12c509
radix dec
include "p12c509.inc"
__FUSES _MCLRE_OFF &_CP_OFF & _WDT_OFF & 0xFFE ;Internal osc.
cblock 0x07 ;Variables
i ;Loop counter
x ;Scratch
y ;Scratch
sr0 ;32 bits of shift register
sr1
sr2
sr3 ;/
endc
org 0x0
;
; PIC12C508 cold starts at 0XFFF (where it loads a factory-programmed
; internal osc. calibrate value). It then rolls over to 0x0.
;
movwf OSCCAL
goto start
;
; Subroutines in 12-bit PIC series must go on bottom page of ROM.
;
wait movlw 35 ;Change this number for different sound if using
movwf i ;'wait' rotuine (normally disabled).
loop decfsz i,F
goto loop
retlw 0
;
; Main code area traditionally starts at 0x100 on a 12-bit PIC.
;
org 0x100
start movlw b'11000000' ;Turn off T0CKI
option ;/
movlw b'00000000' ;Preset outputs to come up low
movwf GPIO ;/
movlw b'00000000' ;Set the I/O direction (all bits output)
tris GPIO
clrf sr0 ;Might as well start with a seed of zero.
clrf sr1
clrf sr2
clrf sr3 ;/
;
; The main loop 'taps' is 24 CPU cycles. At the 4MHz internal clock
; rate, the noise output is operating at a max. rate of about 21KHz.
;
taps btfss sr3,6 ;Get bits 18 and 31 for the feedback XOR.
bcf x,0
btfsc sr3,6
bsf x,0 ;Bit 31 -> x
btfss sr2,1
bcf y,0
btfsc sr2,1
bsf y,0 ;Bit 18 -> y
movf y,W ;!(x XOR y) -> carry
xorwf x,F
btfsc x,0
bcf STATUS,C
btfss x,0
bsf STATUS,C ;/
rlf sr0,F ;32-bit shift
rlf sr1,F
rlf sr2,F
rlf sr3,F ;/
;
; Put a pseudorandom bit out to the speaker. In this example, GPIO bit 0
; (pin 7 on the PIC12C508) is used. Be sure to use a 470 ohm resistor for
; speaker or 10K or better for input to an op-amp/divider/whatever.
;
; Also, to use all six GP bits for noise, just comment the following 4
; lines and uncomment the 5th and 6th lines.
;
btfss sr3,7 ;line 1
bcf GPIO,0 ;line 2
btfsc sr3,7 ;line 3
bsf GPIO,0 ;line 4
; movf sr3,W ;line 5
; movwf GPIO ;line 6
;
; Uncomment the following 'call wait' to experiment with changing the
; 'texture' of the noise (see 'wait' routine, above).
;
; call wait ;Optional delay routine to alter sound
goto taps ;Ad infinitum...
;
; That's all, folks!
;
end
part 4 131 bytes
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.