EmbDev.net

Forum: µC & Digital Electronics Header for PIC16F688 with C-Compiler


von Stefan Hölfer (Guest)


Rate this post
useful
not useful
Hi, first of all: I´m new to coding for PICs. I´m trying to code my very 
first programm in C. I´m using MPLAB IDE v8.90 with HI-TECH ANSI 
C-Compiler.
I used to code some minor programms in Java so I decided to code in C. 
Assembler seems very difficult to me. So my question is. I want to 
configure my PIC16F688 with internal clock so that it lights up and 
blinks a LED. The coding is not the biggest problem. My problem is the 
configuration of the PICs Pins (include/header). I hope you guys can 
help me with this and give me an advices and maybe a description what to 
do.

von Erich (Guest)


Rate this post
useful
not useful
Use GOOGLE to look for example projects and learn from them!

  "PIC16F688" project  "Hi-tech" Compiler
  "PIC16F688" project  "Hitech" Compiler

  "PIC16F688" project  "Hi-tech" Compiler mcp "source code"

regards

von Stefan H. (stefan_h68)


Rate this post
useful
not useful
Thank you for the quick answer.
I already used google but I cant find anythig which helps me. I just 
need to configure the pins and how to implement them in code and how to 
set up the clock

Edit: or can you recommend an other IDE or programming tool?

von c_prog (Guest)


Rate this post
useful
not useful
Ok real quick:

It seems like you're actually trying, unlike a few other posts I've seen 
here where the OP is basically asking for someone to design a complete 
board for them with very little information.

The OSCCON register sets the internal clock frequency.  Just worry about 
bits 6 through 4.  The others shouldn't matter.

Next you have to config the pin connected to the LED as an output.  Say 
you want to use pin 8; you'd have to clear bit 2 of TRISC since pin 8 is 
bit 2 of port C.  The bits in a TRIS register must be cleared to make it 
an output, and set to make it an input (think 1 for input, 0 for 
output).

Sometimes there's a register that configs a pin for use with the A/D, or 
as a digital pin.  I don't see it on this chip.

As for the configuration bits (what is set in MPLAB, page 111 of 
datasheet), make sure the watchdog is disabled for now, WDTE, and set 
FOSC to binary 100.  That sets it to use the internal oscillator.  Make 
sure the MCLR pin is pulled to +5 so it doesn't get stuck in reset.

As for the format of how to write to these registers, look at some 
examples provided with HITECH.  I don't recall how that one works.  You 
could take a look at my website.  I have some example code on there for 
other PICS.  Actually, now that I think about it, I believe the single 
digit clock I have there uses the 688.

http://users9.nofeehost.com/jmiller/

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.