Seems like everybody is...I'm going to have to first state that I am the noob of all noobs.
Maybe so...but what's really 'dumb' or 'really simple' is when the answer is right in front of you in the little green book.So in short some of my questions might be really dumb or really simple to answer.
Why are these simple projects always part of a 'senior design project'? Senior in high school or senior in college? If senior in college, somebody better get their money back.I'm programming a 16F88 PIC to complete five basic task for my part of the senior design project.
If this is part of some sort of class, you'd think that there would be resources to possibly use more than a 16F88. But, the 16F88 is a good choice for a simpler project...We chose the 16F88 simply because it was used in an earlier lab so we had one on hand and it was the only microcontroler that I had seen any programming done on.
Most, if not all, of these questions can be answered by looking in the little green book...I've written out a code that I thought would work, but it doesn't complete any of the tasks that I want it to. Some basic questions would be, can I use a single input port and a single output port for each of the tasks that I'd like to complete? If so am I assigning the ports right by using TRISA.0 = 1 to set port A.0 to input and TRISB.0 = 0 to set port B.0 to an output? I'm using the SERIN and SEROUT commands to send serial data and I understand the first command after SEROUT is the pin you want to use and the next is the baude rate you're using, but what is the next instruction for and how do I know what to assign to it? Finally can you send hexadecimal commands out of the pic Serially to be understood by the LCD? Below is a copy of the code that I have so far. Any and all help is greatly appriciated.
As far as your code goes...
DEFINE OSC 20 'SET OSCILATION TO 20MHz
------------------Doesn't set the oscillation to 20Mhz. It only tells PBP what you are going to use for an oscillator. It's up to you to get the oscillator to work.
TRISA.0 = %1 'SETS PORTA.0 AS AN INPUT
TRISA.1 = %1 'SETS PORTA.1 AS AN INPUT
TRISA.2 = %1 'SETS PORTA.2 AS AN INPUT
TRISA.3 = %1 'SETS PORT A.3 TO AN INPUT
-------------- TRISA=$0F does the same thing....
-------------- same notes for TRISB
SERIN SERIAL_INPUT,T9600,[1] 'MAKES PORTA.0 A SERIAL INPUT PORT
SEROUT SERIAL_OUTPUT,T9600,[1] 'MAKES PORTB.0 A SERIAL OUTPUT PORT
SEROUT BCKLGHTO,T9600,[1]
-------------- If you are connected to an actual RS232 port, these won't work too well....
PAUSE 10
-------------- Read the little green book to see why this won't work for a 10 second pause...
LOOP: IF (X<3) THEN 'sends out a high voltage for .5 seconds
-------------- No real need to put X<3 inside parenthesis, but not a bad idea...
And to tack onto everything BobK has already said (every bit of which I agree with 100%, except the manual part), we'll help you figure out what's wrong...but we aren't going to write the code for you. Apparently, you're in school to learn, SO LEARN!![]()




Bookmarks