gnupic: PIC16F628 and thanks
Subject:
PIC16F628 and thanks
From:
####@####.####
Date:
17 Aug 2002 08:54:29 -0000
Message-Id: <Pine.LNX.4.44.0208170423410.6365-100000@localhost.localdomain>
hello everyone --
thank you a bundle to everyone who offered support and pointers on
starting PIC programming. I have since bought a bunch of components and
picked up both the first Benson book and the Myke Predko book, and I'm
using the famed El Cheapo to program the PIC16F628.
I chose this chip because my ultimate goal is to build MIDI controllers,
beginning with a simple footpedal. The 628's built-in UART should make
this pretty smooth, but i still have a ways to go.
My current problem is that I can't seem to get RB4 on the 628 to control
an LED. I presently have 8 LEDs on my breadboard hooked up through 1K
resistors to the ground, and using the internal oscillator. I'm just
trying to get it to count in binary, but the 5th LED never turns on. It's
not an electrical problem -- if you pull the resistor or the LED the
circuit goes nuts, counting like mad.
does anyone have experience with this particular model and can offer some
insight? here is my present code:
---
list p=16F628
radix hex
#INCLUDE "p16f628.inc"
__CONFIG _INTRC_OSC_NOCLKOUT
org 0x000
start CLRW ; clear my working register
movlw b'00000111' ; disable comparators
movwf CMCON
clrf PORTB ; Init output latches for port B to 0
movlw B'00000000'
tris PORTB ; Set all of PORT B to outputs
MOVLW B'11111111' ; Set A as inputs
tris PORTA
movlw B'00000000'
loop addlw B'00000001' ; add 1 to the work register
movwf PORTB ; move W to port B
sleep ; wait a bit. don't care how much yet.
goto loop ; lather, rinse... repeat
end
---
also: how can i do C programming for the PIC? i've downloaded and
compiled sdcc, but i can't find any docs on PIC compiling.
BTW: Scott, gpasm compiles perfectly out of the tarball on Mac OS X (with
the developer's kit of course). if i can be of assistance with checking
OS X compatibility, please let me know.
-matt
--
Matthew McCabe ####@####.####
Project Manager, Escapement Arts & Media
http://www.escapement.net/
office: 804-440-7556 mobile: 804-400-0515