1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Using functions

Discussion in 'Oshonsoft' started by camerart, Apr 21, 2017 at 1:32 AM.

  1. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,081
    Likes:
    8
    Location:
    Dorset UK.
    Hi,
    Here is a program for changing registers on an SX1278 module.
    I was helped by having a function routine written for me, but don't fully understand it.
    If you run the program in Oshonsoft with the LCD module you should see the first setting=9 then the second setting=136 these are the two changes as seen under GENERAL INITIONALISATION

    This works but I can't be sure it is doing what's intended. What is supposed to happen is the result should be SPIsend = 9, which is shown on the LCD but is it actually what would be sent, or just the result of the function.

    To further complicate things, I temporarily used the SPIsend result to show on the Oshonsoft LCD that the program is working, but in real life, the LCD should be showing the result from the SPIReceive. (which I'll change later)

    I hope this makes sense:)
    Camerart.
     

    Attached Files:

  2. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,081
    Likes:
    8
    Location:
    Dorset UK.
    Hi,
    I think I may have the answer!
    I changed:
    result = spi_func(w_setregtcxo, crystal, r_setregtcxo)
    Gosub lcd

    T:
    send_spi = spi_func(w_setregtcxo, crystal, r_setregtcxo)
    Gosub lcd

    Hopefully, I better understand the function now. Let me know, I'm correct please.
    NOTE: In the circuit, I would read the SPIReceive, to check that the registers were being changed ok.
    C.
     

Share This Page