Simple Microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by tryingtolearn, Apr 9, 2010.

  1. tryingtolearn

    Thread Starter New Member

    Apr 4, 2010
    17
    0
    I must be slow or something cause i can not get anything to work. I am trying to do a code for just a single blinking light in mplab ide. my code is as follows straight from a book. I wrote it in notebook and saved as .bas file and tryed to compile it in mplab?

    void main() {
    Loop:
    High PORTB.1
    Pause 1000

    Low PORTB.1
    Pause 500

    Goto loop

    End

    }

    I tryed adding #include <18f1320.h> at the top but it errors saying it cant find it? Any information would be really appreciated. Thanks.
     
  2. AlexR

    Well-Known Member

    Jan 16, 2008
    735
    54
    How is your hardware set up?
    What compiler are you using?
    What language?
    What processor?
    What error messages?

    We may be good but we are not mind readers. If you want help provide all the information that is relevant so we can at least make an informed guess. Simply saying "it can't find it" tells us nothing.

    Having said that, "#include <18f1320.h>" is a C language statement. Your code looks like it is written in some version of Basic and the fact that you state you saved it with a .bas extension also suggests to me that you are using Basic.
     
  3. tryingtolearn

    Thread Starter New Member

    Apr 4, 2010
    17
    0
    Sorry I was just frustrated and still am. I am trying to follow along in Basic for PIC Microcontrolers. I started trying to use mplabs with Hi Tech compiler which came with my pickit 2. It tells me to write that code in notebook, save as .bas, then compile. So i do so, load into mplab and right click on file then click compile and all kinds of errors pop up. I know I'm missing something and probably quite basic. As I know #include calls for another file which I did find a 18f1320.h file on the net. but when I use that it errors saying missing #device. By no means am I asking for the easy way out. Just a point in the right direction. Thanks.
     
  4. tryingtolearn

    Thread Starter New Member

    Apr 4, 2010
    17
    0
    at this particular time I'm just trying to get the coding to pass, I do have a 10k in my main setup. When I use the ISCP to program it, do I also need a 10k in line with the MCLR pin connection coming from the ICSP? And thank you for your pointers.
     
  5. tryingtolearn

    Thread Starter New Member

    Apr 4, 2010
    17
    0
    OK, I added TRISB=0 on the first line of the code, now when I right click the .bas file in the other folder and click compile it completes and says build successful, but it never makes the asm and hex files like the book says.?? And when i go to project and click build it fails and says Error [939] ; . no file arguments?
     
Loading...