Shop OBEX P1 Docs P2 Docs Learn Events
Wild ADC fluxuations — Parallax Forums

Wild ADC fluxuations

RS_JimRS_Jim Posts: 1,768
edited 2023-01-15 00:10 in PASM2/Spin2 (P2)

I am using @JonnyMac's adc code "jm_adc_multi_1.spin2 in a read loop with the NRF24L01+ wireless transceiver. The code is essentially this
``
idx from 0 to 7

_payload[idx] := adc.read[idx]

``
Do I need to run the adc code in a separate cog and average the read results into an array and pass the array address to _payload? Currently the loop is running about once ever 100Ms.
Thoughts or suggestions? I am Compiling under flexprop 5.9.25Beta.
Jim
Post edit: I remembered that flexprop 5.9.35 has a zip function so I am attaching the zip. This is compiled in that version of flexprop and loads into a KISS0001 board.
edit 2: I attached the wrong zip file, I attached the RX end of the link not the TX end. See my confused thread for the correct files.

Comments

  • JonnyMacJonnyMac Posts: 9,159
    edited 2023-01-14 00:50

    There is no jm_adc_multi.spin2 in that archive, nor is there a file stat starts with P2_robot_RX. I'm confused, and I hate being blamed for problems I didn't create.

  • evanhevanh Posts: 16,028

    I found the main source file - P2_robot_RX.1.spin2 - in subdirectory. But it doesn't have any jm*** object.

    OBJ
    
        ser  : "com.serial.terminal.ansi"
        cfg  : "boardcfg.kiss"
        nrf24: "wireless.transceiver.nrf24l01"
    
    VAR
    
        byte _payload[32]
        byte _payld_len
        byte _syncwd[5]
    

    And there is only three lines referencing _payload:

            bytefill(@_payload, 0, 32)
    
            nrf24.rx_payld(_payld_len, @_payload)
    
            ser.hexdump(@_payload, 0, 4, _payld_len, _payld_len)
    
Sign In or Register to comment.