Old and beyond help ?


Closed Thread
Results 1 to 40 of 47

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default It is good practice

    Hi,

    It is good practise to set the PORT to a known state before using the TRIS register to enable the outputs. When the pic starts up the PORT register can be anything so by setting it before we enable the outputs we dont have to sit there looking at our project going up in smoke just becuse the PORT ended up at a random unlucky combination.

    /me

  2. #2
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Thanks Jumper I take the point. Now another daft question. In order to get my Christmas "Star of David" working I need three 8 bit ports and was planning to use the 44 pin demo board. Port A.6 and PortA.7 will not work as outputs presumable because they are connected to the crystal . Sinc I am using the internal oscillator can I do anything to make these two pins available as outputs. Incidentally maybe I am going blind but I can't see any reference to the osccal command in the manual.
    Cheers

  3. #3
    Join Date
    Oct 2004
    Location
    North Norfolk UK
    Posts
    146


    Did you find this post helpful? Yes | No

    Default

    Hi David

    One quick way to always find out what pins can do is look at the graphical pin layout in the datasheet in this case for the 887 on page 6, It shows the osc pins as being multiple use. I might then look on table 1-1 on page 16 and find say RA6/osc2/clkout and the table will describe, as it does here, that this pin can be assigned RA6 (portA 6) or osc1 or clkin. Also gives brief info and again in this case gives a bit more info that RA6 is a TTL CMOS general purpose I/O, Usually these chips are defaulted in their pin configuration but are easily changed, I would then search down to page 45 which confirms how these pins can be used.

    I might guess that if you choose the internal osc without a clock_out/in then the pin could become an I/O, so then I might hunt through section 4, I know it might sound boring but once you have read and got a feel for the oscillator module on one chip all the others are very very similar. I have not been following your project and I am just looking in briefly, so I hope I may have helped rather than hindered but I see you have been grappling with the config fuses already.

    Don't worry I'm sure you'll get those lights up before Crimbo.

    anyway doesn't one only need 12 leds to represent this particular motif


    __

  4. #4
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Thanks Duncan thats very helpful. Bit of bedtime reading of the data sheet.
    This isn't the star of David that rose in the east this is the one that rises in the west then flashes and rotates etc.
    Thanks for the info

  5. #5
    Join Date
    Oct 2004
    Location
    North Norfolk UK
    Posts
    146


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by DavidFMarks View Post
    this is the one that rises in the west then flashes and rotates etc.
    A very secular star that happens to belong to David then, have you envisaged it playing a little tune


    ____

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


    Did you find this post helpful? Yes | No

    Default

    Three pins are all you need.
    http://www.picbasic.co.uk/forum/showthread.php?t=10200

    Not the star of David though...
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Hi
    My secular star of David has 16 arms each with 8 hi-brite leds so the easy way (i think) is a matrix which requires 24 I/O pins. Whilst I could use some other Ports it would be nice the way I have set up the 44 pin demo board to use Port A. Two questions now arise:
    1. Can I use RA6 and RA7 as outputs if there is a xtal connected across them ( do not know what the DC characteristics of a xtal are)
    2. How the devil do I program the 16F887 so that those two pins are available as outputs. I understand that I have to set up the configuration word (register 1) so that bits 2 -0 are 100 which should set the two pins as available for I/O (subject to item 1 ((above)) But what is the syntax for doing this ? I see no rference in the Picbasic manual (or anywhere else) to this. I have looked at examples but cannot figure it out from that. Any advice on this would be appreciated
    Cheers

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