12f675_fuse_about_to_blow!


Closed Thread
Page 1 of 24 1234511 ... LastLast
Results 1 to 40 of 929
  1. #1
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562

    Default 12f675_fuse_about_to_blow!

    Hi everyone. Oh boy do I need some help here!

    I've just purchased a PICkit1 Flash Starter Kit. I've loaded the MPLAB IDE software and the PICkit1 Classic program and been able to load and re-load the demo hex code.

    So, time for me to program the 12F675 to turn a single LED on, oh deary me.At this point several questions arise.

    1/ I notice that the PICKit demo program has two program files, one .ASM the other a 'C' program and also the Holy grail here an HEX output file. So question:

    What program language do I start to learn Assembler code or C programming?

    2/ I'd like for starters to write a program whereby I put 5v on input pin 4 and that makes an output pin 7 go +5v and lights an LED,no more complicated than that.

    Can anyone point me in the right direction here?

    All help really appreciated.

    LEDave

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi LEDave,

    Welcome to the PICBasic Pro forum. What language you want to learn? I personally wanted something easy and quick to allow me to turn ideas into actual working projects. Both assembly and C were too complicated for me. I started with PIC Basic with the Basic Stamps and after one great project I was hooked and moved up to PIC Basic (PBC) using PICs and then onto PICBasic Pro. I have made quite a few projects (and lots of money too!) that were relatively easy to create and implement. Ms. Melanie (site adminstrator) once said "as long as your project works the way you want it to what difference does it make what language you use".

    If you are interested in assembly or C you might want to check out the Microchip website. I think there are some other sites available also. Google should help you find what you are looking for.

    HTH,

    BobK
    Last edited by BobK; - 16th February 2010 at 04:55. Reason: correct spelling

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    What program language do I start to learn Assembler code or C programming?
    LEDave
    1. Assembler . . . zero cost, much brain damage, much tedious typing.
    2. C language, Can be High cost to about PBP cost, less typing, less brain damage, still much more of both than PBP.
    3. PBP near English syntax, no silly bracketing { . . . } Moderate to low cost, Cheap upgrades, which include new manual, less brain damage. There are things you will have to learn regardless of your choice, like how to interpret a data sheet, which is probably the steeper part of the curve. PBP is available in the UK from Crownhill
    Do not buy from an Unauthorized seller (I. E. Ebay ) as you will not be able to upgrade product.
    Code:
    DEFINE OSC 4
    GPIO = 0 ' set all outputs low
    TRISIO = %00000001 'Set GPIO.0 to input
    cmcon = 7 'Disable analog comparators
    ANSEL = 0 'disable analog select so ports work as digital i/o
    
    
    main:
    if GPIO.0 = 1 then GPIO.1 = 1 'turn it on
    pause 500
    gpio.1 = 0  'turn it off
    goto main
    
    end
    Here go for a test drive:
    http://melabs.com/pbpdemo.htm
    Last edited by Archangel; - 16th February 2010 at 08:59.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default Thank you..............

    First off, many thanks for the replies Bob & Joe, very much appreciated I can assure you.

    So programming these devices in 'C' and Assembler is out and using PIC-BASIC seems the way to go right?

    A few more questions then if I may.

    1/ Can I still use my PICkit1 Flash Starter kit to load / run and test my programs even using PIC-BASIC (I'd hate to think I'd bought the kit for nothing). Or do I have to buy another evaluation board from Melabs as well as the program / compiler?

    2/ Just to make sure here, PIC-BASIC isn't included in my Microchip PICkit is it?

    3/ Will the PICBASIC PRO™ Compiler Demo from Melabs allow me to run and create a HEX code for the program that Joe posted for me? And can I then load the HEX code into my PICkit Starter Kit and into a 12F675 chip?

    I hope all my questions make sense and thanks for your time everyone.

    LEDave

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    So programming these devices in 'C' and Assembler is out and using PIC-BASIC seems the way to go right?
    Most of us here think PBP is the way to go Mix a little ASM in now and then and you will be able to do just about anything you can think of.
    1/ Can I still use my PICkit1 Flash Starter kit to load / run and test my programs even using PIC-BASIC (I'd hate to think I'd bought the kit for nothing). Or do I have to buy another evaluation board from Melabs as well as the program / compiler?
    All Pic Basic Pro is for is to make a HEX file. You will not need to buy another programmer until you out grow the PICkit1. Then get the PICkit2.
    2/ Just to make sure here, PIC-BASIC isn't included in my Microchip PICkit is it?
    No, it is not. All the PICkit is for is to take a HEX file and place it on the chip.
    3/ Will the PICBASIC PRO™ Compiler Demo from Melabs allow me to run and create a HEX code for the program that Joe posted for me? And can I then load the HEX code into my PICkit Starter Kit and into a 12F675 chip?
    Yes. I still use my PICkit1 now and then.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    mackrackit

    Thanks for the speedy reply.

    Have I got this right? I can use the "PICBASIC PRO™ Compiler Demo from Melabs" and make some simple 12F675 projects without having to buy anything else.

    And then, when I get more confident I can buy the BASIC or PRO-programmer / compiler.

    Or do I have to buy the BASIC-programmer / compiler now before I can go any further.

    LEDave

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Unfortunately the demo will not work with the 675, but the PICkit1 will work with most any 14oin or 8pin PIC.
    Demo version PIC® MCU support:

    PIC12F683, 16F627(A), 16F628(A), 16F84(A), 16F688, 16F690, 16F87, 16F88, 16F870, 16F871, 16F872, 16F873(A), 16F874(A), 16F876(A), 16F877(A), 16F882, 16F883, 16F884, 16F886, 16F887
    And the demo is limited to 31 lines of code.

    Yes, try before you buy. That is what the demo is for.
    In my opinion if you are going to stay with MCU programming, get the pro version.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    mackrackit

    So if I buy the 'pro version' I can use my PICkit1 to load the hex file into my projects?

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Yes.

    PBP will generate the HEX. Then you will use the PICkit1 software to load the HEX onto the PIC. The PICkit does not care who or what makes the HEX.
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    mackrackit

    So if I buy the 'pro version' I can use my PICkit1 to load any HEX files I create into my projects?

    What about the program Joe S wrote for me in this thread (Is it written in PICBASIC) how do I turn that into a HEX file and run it on my PICkit?

    Oop's sorry for double posting I lost my way there for a second.

    Also interesting website of yours.

    All very confusing right now but I'll get there.

    LEDave
    Last edited by LEDave; - 16th February 2010 at 18:53.

  11. #11
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    So if I buy the 'pro version' I can use my PICkit1 to load any HEX files I create into my projects?

    What about the program Joe S wrote for me in this thread (Is it written in PICBASIC) how do I turn that into a HEX file and run it on my PICkit? Will my MPLAB IDE convert it?

    Oop's sorry for double posting I lost my way there for a second.

    Also interesting website of yours.

    All very confusing right now but I'll get there.

    LEDave

  12. #12
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Yes, the code Joe wrote is in done in PBP.

    BASICS....
    When you get your PBP CD there will be a program there called Micr Code Studio (MCS). This is where you will write your code. You can use other editors but MCS is probably best for starters.

    Copy Joe's code into MCS or write your own. There are config fuses that need set, Joe did not include that but we can go over that when you are ready.

    Once you are happy with the code there is e a "button" in MCS to click and PBP runs to compile the code into HEX. The HEX is saved in your project directory.

    The PICkit1 has software of its own. Open that and open the HEX created by PBP using MCS. There will be a "Write" button in the PICkit software. ( you already know about that I guess).

    My web site is a work in progress. I hope it will help someone along the way.
    Last edited by mackrackit; - 16th February 2010 at 19:04.
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    "There will be a "Write" button in the PICkit software. ( you already know about that I guess)."

    Yes I've managed to load / erase and reload the demo HEX programs.

    So I need to save up some pennies then for the pro-version, all fascinating stuff though and I will get there.

    Like Arni, I will be back.........!

    Many thanks

    LEDave

  14. #14
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,
    I'll expand a bit on what's already been said. Not because any of it is wrong, just trying to help you get the picture.

    This is basically how the code gets from PBP syntax to a .hex file in your chip:
    IDE -> Compiler -> assembler -> device programmer -> PIC

    1) IDE. Integrated Development Enviroment (a fancy word for a text editor on steroids) This is where you actually write your PBP program, it can be Notepad or MicroCode Studio, which is included with PicBasicPRO when you buy it. The later is recomended but not needed.

    2) Compiler. This is PicBasicPro - it compiles or "translates" your BASIC statements and commands into assembly language that can then be converted to a .hex file by the...

    3) Assembler. There are two assemblers available, one comes with PBP and one comes with MPLAB. There are times when one needs to use the one over the other but lets not get into that at the moment. The assembler is what takes the assembler listing that the compiler produced and generates a .hex file that can be programmed into the PIC by the....

    4) Device programmer. This is the hardware devices and it's associated software used to get the .hex file fromt tha harddrive on the computer into the actual PIC chip. As you probably can see here it doesn't know or care how you got that .hex file.


    This may sound like a lot but if you use the MicroCodeStudio IDE it all happens behind the scene. You type in your BASIC program and hit the compile button and out comes a .hex file ready to be programmed into your PIC by the PICKit1 or any other device programmer supporting the PIC-chip you're using.

    If you're lucky the PicKit1 is even directly supported by MicroCodeStudio. IF that is the case you don't even need to launch the PicKit1 software to get the .hex file into the chip - MicroCodeStudio handles that for you as well. One single click get you from BASIC code in the IDE to a programmed chip.

    /Henrik.

  15. #15
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Thanks for that Henrik, very informative.

    What would you suggest I do now? Buy the PicBasicPRO and start learning or go another route in the interim.

    Dave

  16. #16
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default

    Well, it depends on what your goal is. If all you want to do is turn an output on when an input goes high you can get away with the demo but I guess you're ultimately looking to do more (way more) than that.

    If you are taking this seriously then by all means buy PBP, it's worth every penny. There are other compilers, both BASIC and other languages (C, PASCAL etc) available but since this forum is aimed at the products from Melabs (PBC and PBP) specifically that is what we like to use and discuss "around here".

    As you know, it IS associated with a learning curve though so you SHOULD start small, just like with the example you posted. Blink a LED, blink two LEDs, get a LCD up an running etc etc - small steps. Trying to bite off too much at one time will only get you frustrated.

    Good luck!
    /Henrik.

  17. #17
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,

    Get PBP. You'll never regret the investment. I own/use 3 high-end C compilers, and do a lot of commercial work. I can push 99.9% of my embedded controls work out of here, all done with with PBP, and never have to worry about it working as expected 20 years down the road.

    It's rock solid, and a lot easier than using C. There's only 1 other basic compiler for the PIC that's worth a look, but it hasn't had anything but beta updates for the last several years. And you have to jump through hoops just to install each new beta version.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  18. #18
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Once again thanks to everyone for their input and help.

    It's looking like PICBASIC PRO Compiler 2.60 is the one to aim for right?

    I appreciate the learning curve I have to work through but I am a plodder and will gradually build up my knowledge base (along with one or two questions on here no doubt).

    Any other areas I should look into to start the learning process?

    Many thanks: Dave

  19. #19
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Many will buy books to start learning, so far in my opinion there are not any out there worth anything. Bruce is working on one, when it comes out I will change my mind. Until then his site is a good place. Left hand side about half way down.
    http://rentron.com/

    Examples to work on from MeLabs, along with the PBP manual.
    http://www.melabs.com/resources/samples.htm

    And of course this forum. Steve put this post together just for this purpose.
    http://www.picbasic.co.uk/forum/showthread.php?t=11116

    And do not forget to have the data sheet for the PIC you plan to use handy.

    That should get you started.
    Last edited by mackrackit; - 17th February 2010 at 02:33.
    Dave
    Always wear safety glasses while programming.

  20. #20
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Download the PBP demo: http://www.melabs.com/pbpdemo.htm

    You can make enough, in short order, just by selling nifty things you create with the PBP
    demo, to buy the full version. I personally know several college students that have used
    the demo version to make a fortune.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  21. #21
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Yes, the code Joe wrote is in done in PBP.

    BASICS....
    When you get your PBP CD there will be a program there called Micr Code Studio (MCS). This is where you will write your code. You can use other editors but MCS is probably best for starters.

    Copy Joe's code into MCS or write your own. There are config fuses that need set, Joe did not include that but we can go over that when you are ready.
    Joe did not include those, because the "DEFAULT" config located in the 12F675.inc file will work and I did not want to add to his confusion, rather just to demonstrate how simple PBP really is, but I digress, Dave (mackrackit) is right, Configs are something you will have to deal with, regardless of your choice of compiler.
    In a nutshell _ _ _ You write a program in C or PBP and compile it into an assembly program, the Assembler, I E MPASM, turns it into a HEX File and your PICKit stuffs it into the PIC. And If you wrote it right then your PIC is Fat, Dumb and Happy Doing what you ordered it to do. And yeah, I know the demo does not support the 675, so 2 bucks? gets you a 12F683 which it does support. As for your programmer, it will stuff the hex from any of the methods available as long as it supports the chip you have chosen. My first programmer was a JDM clone from an eBay seller in Bulgaria for $8.00 US, used Iprog, or PonyProg or one of those freebie programs to operate it. The best part about PBP is this forum, nobody here will steer you wrong intentionally.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  22. #22
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    As ever many thanks to you all for your help and guidance.

    I'll download the demo tonight and try and convert the program Joe posted earlier in the thread into a HEX file and load it, Ill let you know how I get on, then take it from there.

    I do suspect there could be one or two more questions popping up along the way.

    Fascinating subject though with loads of possibilities.

    Dave

  23. #23
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I've downloaded the demo program and I'm about to buy 10 of these chips.

    They are the right ones for Joe's LED program? Can anyone confirm please.

    http://uk.rs-online.com/web/search/s...duct&R=6230178

    Dave

  24. #24
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Those are the correct ones.
    Dave
    Always wear safety glasses while programming.

  25. #25
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Cheers mackrackit.

    They should arrive in two or three days time.

    In the meantime I'll try and make a HEX program.

    Finger X'd

    Dave

  26. #26
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    5x12F683 PICS order just placed...........!

  27. #27
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I was looking through some of the helpful links that mackrackit posted on this thread earlier and came across this link below:

    http://www.melabs.com/resources/samples.htm#12F675pbp

    Half way down the page there's a program to blink an LED using a 12F675 PIC so I thought great, I'll copy the HEX file (link below) which I did.

    http://www.melabs.com/resources/samp...BP/BLINKX4.HEX

    I then opened up my PICKit classic programmer and tried to copy the saved HEX code (which I'd saved as a notepad document) into the programmer but I couldn't even find the notepad HEX code, it just doesn't show up in my documents.

    Any ideas on how to load this copied HEX code into the programmer so I can load it into my 12F675 PIC.

    Starting to feel inadequite (I can't even spell it) right now.

    One day when I've cracked the learning curve I'll look back at all this and smile...I hope.

    Dave

  28. #28
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If you copied the HEX and pasted it into notepad... probably why you had problems.

    Now, the PICkit1 board has the LEDs in a matrix. So the coding is a little different than just HIGH this and LOW that.

    Lesson #1
    The PIC has three states a pin can be in.
    OUTPUT HIGH
    OUTPUT LOW
    INPUT

    Here is the code to light the first three LEDs on the PICkit1 on and off, in sequence.
    The HEX is attached. Save it and re-name it taking the ".txt" off.
    Code:
    '16F676     PICKIT1 TEST
    ' PORTA 1,2 4, AND 5 ARE THE LED PINS
        @  __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
        ANSEL = %00000000
        CMCON = %00000111
        
        START: 
        'D0 HIGH
        TRISA = %11001111
        PORTA = %00010000
        PAUSE 500
        'D1 HIGH
        TRISA = %11001111
        PORTA = %00100000
        PAUSE 500
        'D2 HIGH
        TRISA = %11101011
        PORTA = %00010000
        PAUSE 500
        GOTO START
    Attached Files Attached Files
    Dave
    Always wear safety glasses while programming.

  29. #29
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit

    The program worked a treat, many thanks for your time and input on this. I saved the HEX code as Blink.HEX just added .HEX to the end (Doh) and it loaded into the PICKIT1 and then loaded into the PIC and away it ran:

    D0 - D1 - D2 flashing one after the other, brilliant!

    I noticed you wrote the program for the 16F676 PIC yet it ran perfectly on my 12F675 chip, very clever but how does that work? I guess both chips have certain ports and configurations that are common.

    Would it have been possible to have copied the program you wrote and pasted that directly into Microcode Studio - demo and created the HEX file that way? I would like to do this if it can be done to get a feel for converting program code to a HEX file.

    David

  30. #30
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    It was late, I was tired, I picked the wrong PIC...
    Got lucky that it worked...

    But yes, the code will compile with the demo version if it is for the correct PIC.

    Darn bifocals...
    Dave
    Always wear safety glasses while programming.

  31. #31
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Couldn't get it to compile, I had:

    Symbol not previously defined Ansel (I had five of these).

    And one: Overwriting previous address contents.

    ANSEL is analogue select right? It's my understanding that your:

    ANSEL = %00000000 code line makes all the pins read in digital, or turn any analogue input off (I think) so can't understand a problem here.

    Also: CMCON = %00000111 puts out decimal 7 which turns the comparitor off? Is that right? This instruction didn't seem to cause a problem.

    Could all this be because the 16F676 PIC wasn't listed when I compiled it? It wasn't in the demo version drop down list.

    Plenty of head scratching going on here, great fun all though, I'll be glad to figure the basics out.

    Dave
    Last edited by LEDave; - 18th February 2010 at 22:41.

  32. #32
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What PIC did you pick from th drop down?
    Dave
    Always wear safety glasses while programming.

  33. #33
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    12F683 The nearest one to the 12F675 (probably doesn't work like that does it?).

  34. #34
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    This compiles for the 12F683. May not be the correct pins to do the expected, I did not check that.
    Code:
        ANSEL = %00000000
        CMCON0 = %00000111
        
        START: 
        'D0 HIGH
        GPIO = %11001111
        GPIO = %00010000
        PAUSE 500
        'D1 HIGH
        GPIO = %11001111
        GPIO = %00100000
        PAUSE 500
        'D2 HIGH
        GPIO = %11101011
        GPIO = %00010000
        PAUSE 500
        GOTO START
    ANSEL is for turning the ADC on or off. Not clear why it gave an error.
    The CMCON should have though.
    "Overwriting previous address contents" is because I had the fuses set in code and the fuses commented out in the *.inc.
    http://www.picbasic.co.uk/forum/showthread.php?t=543

    Now for some data sheet reading
    Dave
    Always wear safety glasses while programming.

  35. #35
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Is there a set of code instructions for THE PBP demo version?

    I'm trying to get an understanding of GPIO and the register TRISIO. If you set a TRISIO bit low you make the corresponding GPIO pin an output (I think) Except GP3 which is always an INPUT.

    I've got a very blurred picture of how this all fits together, one day the fog will lift.... I hope.

    Dave

  36. #36
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    http://www.melabs.com/resources/index.htm#Manuals
    http://melabs.com/products/pbpis.htm
    I'm trying to get an understanding of GPIO and the register TRISIO. If you set a TRISIO bit low you make the corresponding GPIO pin an output (I think) Except GP3 which is always an INPUT.
    Now I see a mess up in my last code
    Code:
        GPIO = %11001111
        GPIO = %00010000
    should be
    Code:
        TRISIO = %11001111
        GPIO = %00010000
    I think.....
    Sorry about that.
    Dave
    Always wear safety glasses while programming.

  37. #37
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit

    Yes I ran that code and it compiled with no errors.

    I loaded the HEX code (confirmed write successful) but the LED's didn't light?

    I reloaded you earlier HEX file and all three LED's jogging along nicely.

  38. #38
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Yup, different code for different PICs.
    When do your 12F683s arrive?
    Dave
    Always wear safety glasses while programming.

  39. #39
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I changed the code from GPIO to TRISIO

    RE-compiled, re-loaded the HEX code file and away she ran.....!

    Time for me to pause here mackrackit. I need to break your program down and figure out exactly what's going on. That way I can move on.

    I'll try and figure it out and if you'd be so kind you can tell me how I got on.

    It's the only way for me to learn.

    As ever thanks for your help.

    Dave

  40. #40
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I'll try and figure it out and if you'd be so kind you can tell me how I got on.

    I like it when someone wants to learn.
    I will be here....
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts