Announcement

Collapse
No announcement yet.

Bonehead Part III

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bonehead Part III

    Well, bless Leo at MELabs. He got me on the straight and narrow and I think I've got it down pretty well. I hope this is the right forum to ask, but if not, please advise.

    So now I'm going to jump into the deep end and see if I've got this right. I know pretty well what I need the PIC micro to do, but I've got a list of some 500 of them that 3.0 supports. That's a lot of chips to check.

    Is there a tool somewhere that I can load in what I'm looking for (8 pins, two half-amp outputs for 500 milliseconds or so, <1% duty cycle, internal clock ....) and all that good stuff and see if there is a matrix somewhere that takes my needs and spits out one or ten devices that will do the job?

    Thanks,

    Jim

  • #2
    Microchip has its MAPS selection tool at https://www.microchip.com/maps/Microcontroller.aspx

    two half-amp outputs
    You're not going to find any devices with that sort of current handling. You'll have to add an external driver/fet to do that.

    Comment


    • #3
      Originally posted by tumbleweed View Post
      Microchip has its MAPS selection tool at https://www.microchip.com/maps/Microcontroller.aspx


      You're not going to find any devices with that sort of current handling. You'll have to add an external driver/fet to do that.
      That is exactly the link I was looking for. I found just exactly what i wanted.

      As tp tje half amp, that was a brain far+. I have an h-bridge for the driver; all I need is about ten mils to drive the triggers on the bridge.

      Thanks,

      Jim

      Comment


      • #4
        I'm doing some reading and there is a claim that PBP3 will not write code for the older 12F series of PICs. Before I get all wound up in something that won't work, can somebody confirm this statement in a third party reference manual?

        Thanks,

        Jim

        Comment


        • #5
          Define "older 12F series PICs".
          I think the best option for you is to simply look at the list of supported devices: http://pbp3.com/devicelist.html

          Comment


          • #6
            There is a short list of older, small parts that PBP won't support: 10F200, 10F204, 10F220, 12F520, 16F527, 16F570

            Not because they're old, but because they are too limited or have an architectural issue. There are plenty of alternatives with the same pinouts.

            I would advise against using parts with the 12-bit instruction set. Microchip denotes these as "Baseline Architecture". Some them are dirt cheap, though. They just don't have the resources to do much. Note that the PIC12 prefix does NOT denote a 12-bit instruction set (see section 1.5 in the PBP3 reference manual).

            In my opinion, the best PIC12 parts are in the "Enhanced Mid-Range Architecture". The 12F1572 has served me well.

            The Student Edition supports the venerable 12F683, which is still a good part, though a bit slow and limited compared to modern alternatives.
            Charles Leo
            ME Labs, Inc.
            http://melabs.com

            Comment


            • #7
              OK, I'm just not sure how to address the ports on the device I'm using, so if you all wouldn't mind, I'll post the BASIC program I'm writing and ask for comments. The particular device is the 12F609 for a few reasons ... there is one version that I can run from my +12 supply (12HV609) with a dropping resistor, it comes in a tiny SOIC package (I'm severely limited for space), and it has four output pins plus a single dedicated input pin, and it has an internal oscillator that I don't need any external parts to make it work.

              Posting program in an hour or so.

              THanks,

              Jim

              Comment


              • #8
                OK, I think I'm miss-addressing the output port (called GP2, pin 5 of the 12F609) but I don't know what else to call it. Here we go ...
                ******************************************************************

                ' Name : blinkjw.bas
                ' Compiler : PICBASIC PRO Compiler 3.1
                ' Assembler : MPLAB X IPE v5.15
                ' Target PIC : 12F609
                ' Hardware : Lab Protoboard
                ' Oscillator : Internal 4 MHz.
                ' Keywords : LED
                ' Description : PICBASIC PRO program to blink an LED connected
                ' to PORTGP.2 about once a second

                LED var PORTGP.2 ' Alias PORTGP.2 to LED

                mainloop:
                High LED ' Turn on LED connected to PORTGP.2
                Pause 500 ' Delay for .5 seconds

                Low LED ' Turn off LED connected to PORTGP.2
                Pause 500 ' Delay for .5 seconds

                Goto mainloop ' Go back to loop and blink LED forever

                End

                Comment


                • #9
                  Originally posted by jweir43 View Post
                  OK, I think I'm miss-addressing the output port (called GP2, pin 5 of the 12F609) but I don't know what else to call it. Here we go ...
                  ******************************************************************

                  ' Name : blinkjw.bas
                  ' Compiler : PICBASIC PRO Compiler 3.1
                  ' Assembler : MPLAB X IPE v5.15
                  ' Target PIC : 12F609
                  ' Hardware : Lab Protoboard
                  ' Oscillator : Internal 4 MHz.
                  ' Keywords : LED
                  ' Description : PICBASIC PRO program to blink an LED connected
                  ' to PORTGP.2 about once a second

                  LED var PORTGP.2 ' Alias PORTGP.2 to LED <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

                  mainloop:
                  High LED ' Turn on LED connected to PORTGP.2
                  Pause 500 ' Delay for .5 seconds

                  Low LED ' Turn off LED connected to PORTGP.2
                  Pause 500 ' Delay for .5 seconds

                  Goto mainloop ' Go back to loop and blink LED forever

                  End
                  As I expected, the compiler barfs on this line <<<<<<<. But I don't know what else to call it. This is the label given to pin 5 of the 12F609 on the data sheet. I'm wide open to any suggestions as to how to fix it, but I need to know WHY this is wrong and where I should have looked to see what the correct answer is.

                  I also need to know how to set the clock to use the internal 8/4 MHz. free running oscillator with no external components. And, again WHY and WHERE I should have found this information.

                  Thanks for any help.

                  Jim

                  Comment


                  • #10
                    I need to know WHY this is wrong and where I should have looked to see what the correct answer is.
                    Registers are defined in the mpasm device inc files, you cannot simply invent your own , the proper "names" can be found in the datasheet or the pbp manual
                    Click image for larger version

Name:	JW1.jpg
Views:	21
Size:	63.4 KB
ID:	7730

                    to config the int osc ,set the config word to suit your requirement {hint make sure you don't erase the calibration word when erasing chip}




                    Click image for larger version

Name:	JW2.jpg
Views:	19
Size:	55.0 KB
ID:	7731

                    Comment


                    • #11
                      RIchard and others ...

                      Thank you very much for posting your reply (ies). It obviously took you some time to look all this stuff up and I do appreciate the effort. There is just one small problem.

                      I read all this stuff about a week ago and it didn't mean anything to me then. Or now. I see what they are trying to tell me about the device, but nothing about how to achieve the result. I know that bit 7 of the oscillator configuration register needs to be set to 0 for a 4 MHz. clock, but not a CLUE how to write that one line into a MEL BASIC command. I know that there are GPIO pins but not a CLUE what TRISIO and TRISA have to do with each other or what they mean or (perhaps even more important) how to use them.

                      Yes, I've read the MEL PBP manual cover to cover. I've tried my best to understand Chuck Hellebuyck and Dogan Ibrahim's fundamental books on programming in PBP and they both suffer from the same fundamental problem --- they assume a basic level of knowledge that I just don't have. If there was a bonehead basic book on this stuff it would be a blessing, but there doesn't appear to be "The LIttle Golden Book of PIC BASIC Programming" for dummies like me.

                      40+ years ago when I started teaching EE at the local college, a very wise mentor took me aside and whispered two things into my ear before my very first class ... "Remember, there was a time when you diidn't know ANYTHING about this stuff", and, "If you lose them the first day, you've lost them for the semester." He was correct. I have inscribed both of these quotations into my 1955 copy of Terman's great work "Electronic and Radio Engineering" and it is a solemn habit of mine to reflect on his wisdom the first day of every semester ever since.

                      Any pointers to a really simple introduction to this stuff WITH EXPLANATIONS of why we do something one way or the other would really be appreciated.

                      Thank you again for the effort to bring me up to speed ...

                      Jim

                      Comment


                      • #12
                        OK, I've just read Hellebuyck for the answers to TRISA and I think I've about got it down. I'm still VERY confused as to how to set the oscillator. If anybody can write a single line of basic code as to how to set the oscillator I'll give it a try..

                        Thanks, again, gang.

                        JIm

                        Comment


                        • #13
                          a google search "pic for dummies" reveals very few items of any merit for what you seek, it may not exist .
                          i first learned pic programming from articles in electronic magazines like Silicon Chip,Electronics Today and Electronics Australia in the 1980's . those sort of resources are difficult obtain these days.
                          in its day there was great interest in the pic16f84 by and for hobbyists, today its arduino as far as the eye can see

                          imho the best way to begin is to get a development board that has working code examples in pbp3 ,at least then you modify the examples to try your ideas and its possible to refer back to the originals when things go pear shaped.
                          when a sufficient level of understanding is reached then you can brew your own boards . seems that you are diving into the deep end before you can swim as things stand

                          Comment


                          • #14
                            I think if I can find a way to set the clock up correctly I can figure the rest of it out. Tell me, how do I set bit 7 of the clock configuration to zero?

                            Comment


                            • #15
                              its a config fuse ,
                              read the manual about #config
                              also

                              http://www.picbasic.co.uk/forum/showthread.php?t=543


                              google pbp #config


                              Comment

                              Working...
                              X