Continue to Site

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.

  • 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.

Using functions

Status
Not open for further replies.

camerart

Well-Known Member
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.
 

Attachments

  • Functionspi.txt
    5.9 KB · Views: 282
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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top