The basics


Closed Thread
Results 1 to 15 of 15

Thread: The basics

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest

    Default The basics

    I've had a year or so from programming, and even then I was still very much a newbie, and had a lot of help from you guys and gals here.

    For me one of the area's I find hard to get my head round is the config of the basics such as making ports digital, turning on/off analogue pins, etc. I look at the data sheets for most of the PICs I use and I might as well be looking at somthing writen in Vulcan ! I also think that I'm mnot alone, and as such would love to have a point of refference to make things a little clearer. A sticky, or a link to some page on the site would be great

    I'm sure it wouldn't be too hard, as it seems that most pics have things in common, for example most pics with A/D convertors, use the same pins on PORTA, so, for example it would be simple to give examples for setting PORT A up for whatever combinations you could get (with in reason)

    Eg to use the first A/D on pin 1 and set all others to digital use "command" value X, to use two A/D on pin 1 and 2, with the others set to digital use "command" value Y

    Having this sticky / link to web page would also help seasoned members by not having to repeat answers and hopefully it would help newbies learn quicker

    Just a suggestion, but would anyone be willing to create such a post.

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


    Did you find this post helpful? Yes | No

    Default

    Cool idea!! But it has been done.

    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Dave
    Always wear safety glasses while programming.

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks for the link, and it does go some way to answering the questions, but there are occasions, where the user may want to use A/D to read a pot, but also digital I/O on other pins to turn on LEDs for example. Mels excelent post gives the values to turn things on/ off completely.

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


    Did you find this post helpful? Yes | No

    Default

    Well the problem is that so many of the chips are just enough different, I do not think short of duplicating major sections of the data sheet there is a way of doing what you ask.

    Maybe someone could go through all of the different PICs, sort out what ones have the same settings and build a database?

    Or have a wiki type database. When a user come across a chip not on the list and figures it out, add it. Over time it might be useful.

    Myself, I use a dozen or so different chips. I would bet that many here use less. I just do not see how a project like this would be much of a benefit when there are so many other things to learn about the chip one plans to use.

    The data sheet can be daunting, but after it is read a few times it comes together. If one is having problems... Post it.

    But I do like your idea. SQLite would work for the database. I have a server that is not doing much... What do you think? Would that work?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Wink Aladdin and The lamp Genius ...

    Hi, Malc

    Your suggestion sounds to me Freescale " Processor Expert", Cypress " Psoc Express" Microchip "Visual initializer" , Matrix "Flowcode" or similar "high End" IDEs.

    you just choose what you want to do with a Pin and a pre-processor writes the code for you ...

    I think I had such a talk on this forum with Mel when Microchip released its Visual ini. ...

    May be that's not what PBP team has wanted to do ... or could do (Hey, PBP Team : we are still waiting for you to release PBPL Dll ...).

    I seriously think you should turn to another compiler, if you want such features ...
    PBP is not written to do that ...

    But libraries are open ... and you can write the corresponding asm conditionnal assembly routines ...

    Not so good an idea ... in the end !

    cheers

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Alain,

    I think that would be nice, but I think its a long way off if PBP went that route.

    No I think the previous poster understood me a little better. If this helps, let me give you an example.

    I have a 28 pin device, want to use port C as output to leds, port B to an LCD and port A to be a mix of digital I/O for switches, and a pot or two. This is where I (and probably most newbies) stumble when it comes to configuring the PIC. Whilst following Mels post would indeed set up port A for digital, if you want to use one of the AN pins, but have switches on the others, then its confusing. Maybe a database is too complicated, I would simply like somehing along the lines of:

    "to set PORTA.0 to analogue, PORTA.1-7 Digital use ADCON = X"
    "to set PORTA.1 to analogue, PORTA.0 and A.2-7 digital use ADCON = Y

    etc

    On a current project I've resurrected I want PortA.0, 2 & 3 digital for switches, and Porta.1 analoge to read the value from a 10K pot. But I'm not sure what value I need to set ADCON to get this mix.

    EDIT: - I see "bit 3" needs to have a value of 1110 (if I follow the data sheet), but how do I convert that into a statement "ADCON = ???" (Data sheet http://ww1.microchip.com/downloads/e...Doc/39582b.pdf) - I'm using a 16F873A
    Last edited by malc-c; - 21st June 2008 at 21:49.

Similar Threads

  1. Bitwise operations and masks: basics, help?
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 19th April 2008, 00:24
  2. IR software & hardware basics
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 6th May 2007, 10:05
  3. basics programming
    By olivierb38 in forum General
    Replies: 3
    Last Post: - 18th February 2007, 18:56
  4. Timers, oscillators, cycles... need basics please
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th October 2006, 18:33
  5. SERIN basics
    By Michael in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th August 2006, 18:37

Members who have read this thread : 0

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