Timer1 & array confusion; very new to PBP programming


Closed Thread
Results 1 to 9 of 9

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Oops, absolutly correct. I messed that one up by a factor of 10, sorry for the confusion.

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Don't worry about it - I made a similar error on the MC forums this morning. Need to remember to get my morning cup of coffee first.

  3. #3
    Join Date
    Apr 2010
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Thank you guys for such a quick response. And thanks for pointing out that error with the resume instead of a return, must have been out of my mind!

    Also, I would like to ask, if what i posted there is the right way of storing in an array?

    is it like:

    "arraystore[i] = newdata?"

    as for the timer base, i will still have to dig deeper into using interrupts and timer1 function..

    Any extra advices or pointing out of co-existing codes that I could look up to will be appreciated!

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


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Your array code seems OK to me, like:
    Code:
    myArray VAR Word[3]  'Create an array of 3 words.
    i VAR byte
    
    For i = 0 to 2
      myArray[i] = 12345  'Store the value 12345 in array locations 0, 1, and 2
    NEXT
    The absolute easiest way to get started with interrupts is to use Darrels Instant Interrupt routines, they're available on his website. Have a look at the "timer template" - that might be a good starting point for your application.

    /Henrik.

  5. #5
    Join Date
    Apr 2010
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    thanks for your reply! Now, I'm actualling trying to use the SPI capabilities of the 16F88 that will be connected to an arduino. To my understanding, when data is transfered, it is in <binary>? but my questions is, in my programming compiler, do i use the same keywords with the values needed so that the master/slave can communicate?

    I am trying to understand, how is it that I can tell pic A to send this array of information (say a Keypad Code Input of 1,2,3,4) and send it to pic B who is the slave, which then will do something else, and returns a high value or confirmation to pic A that code is verified -> please do this, this and this...

    My professor just tells me about it being sent across as data on the same baud rate/frequency but i dont understand how this 2 diff pics can understand diff languages..

    Any explanation at all, would be greatly appreciated! this forum definitely has really talented and helpful forumers!

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by curian88 View Post
    My professor just tells me about it being sent across as data on the same baud rate/frequency but i dont understand how this 2 diff pics can understand diff languages..
    I may not be much better than your professor but...

    It is not really two different languages. Pretty much anything serial is just a series of highs and lows (0 and 1), sometimes the standard will be for a swing from a negative to a positive, still look at it as high and low.

    The different Operating Systems are sending/receiving the same type of signal. The device sending converts the data into the correct format.. clock timing, and data. The receiving machine will have code to convert this back to something useful.

    So the code on each machine may be in different languages, but they are doing the same thing. You might think about this in internet terms, HTML. Cross platform because the code generating the data and the code interpreting the data both "understand" the HTML.

    This might help some.
    http://en.wikipedia.org/wiki/Serial_..._Interface_Bus

    Sorry if I confused things more. Or was not any help at all.
    Dave
    Always wear safety glasses while programming.

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