EM4095 Chip, get Clock and Data signals?


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    OK I do not know anything about MikroBasic, I know a little "C" and it looks similar, Know this,
    PBP variables are global, whereas C and I think Microbasic are not all global, in c you can make temporary variables that release the registers when not called, all this means is you will encounter variables in mikro and C that are not declared up front, and in converting you will have to, also PBP does not do FP math and uses unsigned integers unless you compile with PBL in which case you will have to use 18Fseries chips.
    here is a few lines to get you started . . .
    Code:
    dim sync_flag,                   ' in the sync routine if this flag is set
        one_seq,                     ' counts the number of "logic one" in series
        data_in,                     ' gets data bit depending on data_in_1st and data_in_2nd
        data_index,                  ' marks position in data arrey
        cnt,                         ' interrupt counter
        cnt1, cnt2 as byte           ' auxiliary counters
        
        data as byte[256]
        data_valid as byte[64]
        
        bad_synch as byte            ' variable for detecting bad synchronisation
    becomes
    Code:
    sync_flag  VAR BIT                      ' in the sync routine if this flag is set
    one_seq    VAR BYTE                     ' counts the number of "logic one" in series
    data_in    VAR WORD                     ' gets data bit depending on data_in_1st and data_in_2nd
    data_index VAR BYTE                     ' marks position in data arrey
    cnt        VAR BYTE                     ' interrupt counter
    cnt1       VAR BYTE
    cnt2       VAR BYTE                     ' auxiliary counters
        
    
    data       VAR BYTE[256]               ' huge 256 byte array
    data_valid VAR BYTE[64]                ' 64 byte array
        
    bad_synch VAR BYTE                     ' variable for detecting bad synchronisation
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Thanks.
    Also, when you say that Variable are global, then if you look at the mikroBasic code, then you would see that there are some variables made in the main section and also in a Procedure some variables are made, which can only be used in that Procedure!
    So what about them?

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    Thanks.
    Also, when you say that Variable are global, then if you look at the mikroBasic code, then you would see that there are some variables made in the main section and also in a Procedure some variables are made, which can only be used in that Procedure!
    So what about them?
    Use different variables.

  4. #4
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    So you mean that i should make them Global too, as there aren't anything UnGlobal in PBP?

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    So you mean that i should make them Global too, as there aren't anything UnGlobal in PBP?
    I mean if they are truly global, then they are the same variable thru the program.
    If they aren't, then the variable most likely has two different meanings in different, distinct functions/modules/subroutines.

    In PBP, all variables are global, meaning that if temp holds a value here, it holds that same value over there, and over there, and over here.

  6. #6
    Join Date
    Mar 2008
    Posts
    43


    Did you find this post helpful? Yes | No

    Default

    Okey, thanks.
    Could you help me with some more, especially the Interrupt, or if it could be done without using Interrupt!! (it could be great if it could be done without)

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mindthomas View Post
    Okey, thanks.
    Could you help me with some more, especially the Interrupt, or if it could be done without using Interrupt!! (it could be great if it could be done without)
    Doubt it...

Similar Threads

  1. Data Out From External Clock
    By Quin in forum Serial
    Replies: 2
    Last Post: - 25th October 2008, 09:11
  2. Data logger clock and array
    By PicLearner in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 25th September 2008, 04:19
  3. Shiftout/in
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd August 2007, 11:48
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  5. MAX1247 4-Channel, 12-Bit ADC
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 15th December 2006, 23:38

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