I would like to write a javascript for waveforms where I control my Digital discovery from a PC via UART, the controllable functions is to write and read to some I2C slaves
Have tried using the "protocol" tool with the I2C tab and scripting. I write the script in the "sensor" tab, I found that this tab works differently from the "Custom" tab.
I2C stuff work allright but when I try to init the UART I get error "ReferenceError: Can't find variable: Protocol line: nn"
function initUart(){
//if(!('Protocol' in this)) throw "Please open the Protocol instrument";
Protocol.Mode.text = "UART"; // make sure UART tab is selected
Protocol.UART.TX.value = 0; // Set up UART TX pin on Digilent AD2 :: DIO_0 Pin
Protocol.UART.RX.value = 1; // Set up UART RX pin on Digilent AD2 :: DIO_1 Pin
Protocol.UART.Bits.value=8; // Sets or gets the UART number of bits.
Protocol.UART.Parity.text="None" ;// Sets or gets the parity setting: “None”, “Even”, “Odd”, “Mark (High)”, “Space (Low)”.
Protocol.UART.Rate.value=9600; // Sets or gets the baud rate setting
Protocol.config(); // apply configuration changes now
Protocol.UART.Receiver(); // reset receiver - that is too start receiving data
if(!FileAppendLine(logfile, "UART init completed")) return "File write failed";
}
Am I trying to do something that is impossible or am I using the waveforms tool wrong?
Question
Klars
I would like to write a javascript for waveforms where I control my Digital discovery from a PC via UART, the controllable functions is to write and read to some I2C slaves
Have tried using the "protocol" tool with the I2C tab and scripting. I write the script in the "sensor" tab, I found that this tab works differently from the "Custom" tab.
I2C stuff work allright but when I try to init the UART I get error "ReferenceError: Can't find variable: Protocol line: nn"
function initUart(){ //if(!('Protocol' in this)) throw "Please open the Protocol instrument"; Protocol.Mode.text = "UART"; // make sure UART tab is selected Protocol.UART.TX.value = 0; // Set up UART TX pin on Digilent AD2 :: DIO_0 Pin Protocol.UART.RX.value = 1; // Set up UART RX pin on Digilent AD2 :: DIO_1 Pin Protocol.UART.Bits.value=8; // Sets or gets the UART number of bits. Protocol.UART.Parity.text="None" ;// Sets or gets the parity setting: “None”, “Even”, “Odd”, “Mark (High)”, “Space (Low)”. Protocol.UART.Rate.value=9600; // Sets or gets the baud rate setting Protocol.config(); // apply configuration changes now Protocol.UART.Receiver(); // reset receiver - that is too start receiving data if(!FileAppendLine(logfile, "UART init completed")) return "File write failed"; }
Am I trying to do something that is impossible or am I using the waveforms tool wrong?
Regards,
Klars
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now