PIC speed problems


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Wow, that was quick. I fixed that little problem and all the flickering seems to have gone away! Ive just been moving those scrollbars as fast as possible and they wont flicker at all now.

    Although i have learned quite a lot from this thread and finally been able to link a lot of that stuff in the datasheet (the registers) to something usefull, i get the feeling that i could have solved this in the origional code simply by replacing "=" with "=>" 4 times.

    Oh well, its not a problem... just a learning oportunity

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Although i have learned quite a lot from this thread and finally been able to link a lot of that stuff in the datasheet (the registers) to something usefull, i get the feeling that i could have solved this in the origional code simply by replacing "=" with "=>" 4 times.
    I smell what you're cooking...and if you'll notice, in my code, I go the other direction than you do (i.e. opposite logic) and use a "<" which is practically the opposite of "=>"
    Funny how it's sometimes the same...but different...

    Show some code...Let the rest of us smell what you cooked (or burned )
    Last edited by skimask; - 8th October 2008 at 00:35.

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Yep, your way looks like the way DT's code did it. You turn everything on then count up and turn each LED off as the counter reaches the PWM value. In my code i turn them all off then count down and turn them on when the counter reaches the PWM value.

    I think i probably did it that way because my previous PWM circuits controlled AC lights through a triac. The way you and DT did it would still work and probably be better for AC lights but it needs those other components similar to triacs (cant remember the name) and they are more expensive.

    Ive uploaded the file so you can take a look. I know theres lots of bits that seem pointless at the moment. Ive got to addin all the other stuff that i had before.

    BTW, that still gets serial data in the main loop. I may still need to buffer it in an interrupt once i have all that extra code back in but for now it works and it doesnt need to buffer all the data that arrives.

    Edit: I commented out the bit that resets the serial flag. When i was having trouble i thought maybe that changing PIR1.5 was causing another interrupt or something but it turns out that it works without it. Reading RCREG seems to clear it anyway so is that really needed?

    Edit2: Ive uploaded a newer version of the code. I used your buffer idea for sending serial data. Not sure if it works because i dont have the PIC here to test it. All i know is that it compiles properly. I still need to figure out how to set the stored address. That will be a tough one
    Attached Files Attached Files
    Last edited by The Master; - 8th October 2008 at 12:39.

  4. #4
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Your code looks good. You have an appreciation for logic, clarity and organization. I see a good programmer.

    Trent Jackson

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Thanx, I started with Visual Basic. VB is used for much larger programs than PBP so its more important to write tidy code but i guess its a good habit to keep with any language

Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 00:52
  2. Pic Vrs Atmel speed
    By shawn in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2008, 21:50
  3. Replies: 14
    Last Post: - 26th September 2007, 05:41
  4. IC2 pic 18f452 program problems
    By MrSafe in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 20th September 2007, 18:55
  5. Help, problems first time with 18F452 PIC
    By MikeTamu in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2005, 20:49

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