A way to remove lookup tables and calculate those values?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: A way to remove lookup tables and calculate those values?

    Since it is not clear to me what you want to acheive, I will attach a simple program in VB6 from which you can see how to use maths for drawing as many points you want on any given circle. All the maths are inside command1_click and should be not too difficult for you to translate the VB code into PBP code.

    Cheers

    Al.
    Attached Files Attached Files
    All progress began with an idea

  2. #2
    Join Date
    Feb 2009
    Posts
    29


    Did you find this post helpful? Yes | No

    Default Re: A way to remove lookup tables and calculate those values?

    I tried using sin/cos calculations and it resulted in the same speed or maybe slightly slower. I am only using 9600 baud out. This may be where im hanging up. I didnt figure that it would be the bottleneck in the operation. The next test will be to bump up the baud rate and see what happens.

    EDIT: I changed over to the USART and set it up at 19200 and sure enough its displaying the gauge points twice as fast. Now, I have to tie the 2 USART transmit pins together because I have to initiate communication with the GPU at 9600 baud and then change the baud rate. I need to change the baud rate for one USART on the fly and re-DEFINE-ing the baud rate doesnt seem to work.
    Last edited by sccoupe; - 2nd May 2011 at 21:51.

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: A way to remove lookup tables and calculate those values?

    I think you will have to address the baud rate reg directly if you want to change on the fly. As near as I can tell, DEFINE will only work once in the program. Someone correct me if I am wrong
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: A way to remove lookup tables and calculate those values?

    You can change the baud rate "on the fly". I generally try to find a combination of BRGH and BRG16 that will give me both of the baud rates that I want with writing only to SPBRG.

    I normally run at 40Mhz, so with the following in the header

    DEFINE HSER_RCSTA 90H
    DEFINE HSER_TXSTA 24H
    DEFINE HSER_CLROERR 1

    Then, in the main program...


    You can run at 9600 baud with the statement:

    SPBRG = 255


    Or at 57600 baud with the statement:

    SPBRG = 42
    Charles Linquist

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