// script expects DIO0 channel
if('SPIMOSI' in Logic.Channels){
    var file = File("~/Desktop/logic/acq_"+Index+".csv")
    var stamps  = Logic.Channels.SPIMOSI.eventStamps
    var MOSIdata = Logic.Channels.SPIMOSI.events
    var MISOdata = Logic.Channels.SPIMISO.events
    file.write(stamps)
    file.write(MOSIdata)
    file.write(MISOdata)
    Index++
}