How long does this take to execute


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Posts
    98


    Did you find this post helpful? Yes | No

    Default Re: How long does this take to execute

    incredibly helpful!, thanks so much again Henrik
    want a job ?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: How long does this take to execute

    Glad I could help.
    As for the job, I'm fortunate to have one that pays the bills but it's not as fun as developing PBP code so if you're serious about that then drop me PM and we can talk :-)

  3. #3
    Join Date
    Nov 2003
    Posts
    98


    Did you find this post helpful? Yes | No

    Default Re: How long does this take to execute

    it almost makes want to think about external hardware UART that has a 512 or 1k buffer, but i guess getting the data into that would be an issue too
    are there such things ?

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: How long does this take to execute

    Took a quick look at the Digikey and of the chips they've got the largest FIFO buffer available is 256bytes. I think you need at least 1k to really benefit from an external UART - and I think the interface would have to be parallel or really fast SPI or you'll spend most of the time sending data to the UART just as you would when using the on chip UART.

    What would be ideal is a PIC with DMA but that feature doesn't exist in the 16F or 18F series. But really, this should be totally doable with a PIC and on chip UART but it'll take some careful planning.

    /Henrik.

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: How long does this take to execute

    Hi,
    I've played around with this a bit, trying to get a feel for what's possible and what's not. It's actually not as bad as I originally thought - but not that great either.

    A 18F25K20 running at 64MHz, interrupting every 44us using DT-Ints slows down the PIC a fair bit. A 100ms pause in the main routine becomes 185ms in reality, a CPU load of 54%. At 32MHz it'll probably not work at all since all avilable CPU cycles will be consumed by the ISR and (mostly) the overhead.

    The good news is that it does work using DT-INTS if you can run at 64MHz. The bad news is of course that any commands used in the main routine, that relies on soft timing, will be WAY off.

    /Henrik.

  6. #6
    Join Date
    Nov 2003
    Posts
    98


    Did you find this post helpful? Yes | No

    Default Re: How long does this take to execute

    well now you've done it Henrik

    i was just warming up to the idea of doing everything in a polled loop and carefully squeezing activities in

    re DT-Ints when you say "soft timing" do you mean things like counting the number of times through the Main Loop (or sub loop) to create a crude counter / timer ?
    i do that a lot for certain imprecise timing requirements, yeah i know it is not good practice and has many down sides but it is good enough for many things

    or do you mean things like PAUSE and PAUSEus ?
    or both ?

    my plan at the moment is to use 18F25K22 (Charles has been most supportive!) and it will do 64Mhz and does 5V which the '20 does not (big advantage as DMX transceiver i am told must be 5V due to custom and practice even though there are 3.3V RS485 transceiver chips out there)

    as to OSC, the way i read the data sheet i can get 64MHz using 4X PLL either with INTOSC or XTAL at 16MHz
    do you think 1% is good enough for RS-485 250k baud comms ?
    my instinct was no and at this point am not inclined to get into calibration schemes (how good do they get?)

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: How long does this take to execute

    With soft timing I mean anything that relies on counting instructioncycles for precise timing, like PAUSE, PAUSEUS, SERIN, PULSIN, etc. Same thing with the stuff that started this thread, we figured out a certain piece of code executes in x number of cycles but when there's an interrupt constantly "stealing" cycles away that timing is obviously no longer correct - nor constant.

    I can't say I understand why the uC must be a 5V one just because the bus is RS485 but the 18F25K22 is a very good choice, if it's got enough pins (otherwise the 45K22) or the 26/46 if you need even more FLASH.

    The choosen baudrate doesn't really matter when it comes to accuracy of the x-tal, if the clock is 1% off then the baudrate will be 1% off att 250baud and at 250kbaud. The internal oscillator is most likely fine but if you're designing a board and you can spare the pins I'd certainly design in the option to use a x-tal. (I'm using the 16F1519 in a project of mine, internal oscillator, on one board of 7 I had to tweak the baudcon register by two counts to get the correct baudrate since the internal oscillator was off. The other boards are spot on.)

    You say DMX tranceiver, are you going to receive data at 250kbaud as well? That will be "interesting"... :-)

    /Henrik,.

Similar Threads

  1. Unable to execute mpasmwin
    By oldmainframer in forum General
    Replies: 3
    Last Post: - 17th December 2016, 23:01
  2. Interrupt won't execute.
    By bison_bloke in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 26th March 2010, 15:46
  3. Replies: 5
    Last Post: - 24th February 2009, 18:55
  4. Proteus Execute Error
    By pramarn in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th October 2006, 08:51
  5. SEROUT2 takes 1400ms to execute?
    By droptail in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th March 2006, 17:08

Members who have read this thread : 1

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