Writing good/proper code


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default Good code & schmitt trigger pins

    Thanks for the advice to date.

    I'm not clear what use should be made of the Watch Dog timer?

    Assume that no activity after X Seconds means something is wrong and re-start? Or is there more to this?

    On a new additional subject: ST input pins. Recently I wanted to use the hysterisis of the ST pins and did a test to check the thresholds.
    Found that PORTB.0 (used as an interrupt INT0) was way off spec for the chip PIC18F8722:

    Go off at 1.6 V
    Go on at 2.7 V

    The spec gives:
    Go off at 1.5 to 1.3 V
    Go on at 3.0 to 3.4 V

    Test voltages supplied via a 10k pot and measured with a good meter - my new FLUKE! The differences are considerably outside spec. Anyone else had difficulties with the ST pins?

    Regards Bill Legge

  2. #2
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Post

    Hi Bill,

    You got the WDT right.

    I must say that i've gone through more than my share of Microchips datasheets and i can't remember ever seeing anything else than the usual 0,2-0,8Vdd spec for ST inputs. So if you're running your pic on 5v, anything less than 1v(0,2*Vdd) is guaranteed to be read as a 0(low) by the pic. Anything above 4v(0,8*Vdd) is guaranteed to be seen as 1(high). Everything in between is to be considered as unknown. This means that your trippoint should be found somewhere in this region. It does not say anything about the amount of hysteresis. I haven't checked this for many years but when i did i found that the trippoint was just below 0.5Vdd and the hysteresis was quite small (<100mv). My memory may be way off though.

    So, if i need an input with a specified trippoint and a specified ammount of hysteresis i use a comparator(or op) with external resistors.

    /Ingvar

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 22:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 22:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 9th December 2008, 00:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  5. Writing code for battery operated projects
    By jessey in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th June 2005, 04:39

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