USART+PWM Problem


Closed Thread
Results 1 to 40 of 44

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by DynamoBen View Post
    Their explanation and what I'm doing in my code match.
    I got a question for you about this chunk of the code:

    IF DMX_State=Valid_SC Then
    For DimmerCount=0 TO DMXStartAddr; Count incoming data bytes (frames)
    Dummy=RCREG ; Read unwanted values
    Next DimmerCount
    DMX_State=Valid_Data
    EndIF

    Does it just happen to work because the baud rate is fast enough that the loop almost can't keep up? How do you know that 'Dummy' always gets loaded with valid data (in this case the unwanted values) from RCREG instead of the same thing that was there last time around in the loop before the next byte actually arrives.
    I would figure that the code would at least poll the RCIF flag and THEN get a new byte from RCREG.
    Just curious...have no need to know, not building any projects anytime soon...(and this all ties back into my post #4 about the bugs...but you probably already figured that out...)

  2. #2
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Well the big thing that is missing here is the fact that this was snipped from an interrupt sub. All my code is interrupt based...to be honest I have actually since scaled back this code to make it a little simpler. I stripped out all the status checks and just bounce from one hserin command to another until I have the values I need.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by DynamoBen View Post
    Well the big thing that is missing here is the fact that this was snipped from an interrupt sub. All my code is interrupt based...to be honest I have actually since scaled back this code to make it a little simpler. I stripped out all the status checks and just bounce from one hserin command to another until I have the values I need.
    Ok, makes sense...

    I wonder if the O/P catches that part of your statement above...

  4. #4
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    I wonder if the O/P catches that part of your statement above...
    O/P, what is O/P??

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by DynamoBen View Post
    O/P, what is O/P??
    Original Poster

Similar Threads

  1. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  2. byte Tx w/ USART 16f876a problem
    By GargamelDigi in forum mel PIC BASIC
    Replies: 2
    Last Post: - 15th July 2008, 05:50
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  5. PWM problem CCP2 port
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 19th September 2006, 23:34

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