This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Tiva C, Matlab,

Hi all,

I have a Tiva-C board that I configure with Keil. I want to perform a simple task - when my MATLAB runs a specific command, I want to send an "On" trigger (analogoutput 3.3V) to a NI PCI Board to start a camera device. Also, I am relativley new in programming in Keil. I have the following questions:

I have a small program that turns a connected LED on and off.

option 1 - Is it possible to write 2 function ledON/ledOFF that can be executed from MATLAB (without a main)? Something like -

  // Make PA2 high
void LED_On(void){
  GPIO_PORTA_DATA_R |= 0x04;
}
// Make PA2 low
void LED_Off(void){
  GPIO_PORTA_DATA_R &= ~0x04;
}

option 2 - should I load a program that runs in a loop and performs the task according to a "package" sent from MATLAB? Something like -

  int main(void){
  LED_Init();               // initialize PA2 and make it output
  while(1){
  In = GPIO_PORTF_DATA_R&0x10;   // read PF4 (read 'input' from matlab)
ChangeLedState(In);'
  }

2) What is the most recommended way to interface a the Keil C-format files with MATLAB? What signal should it read, and how do I specify and connect to a specific GPIO port?

Any further wise suggestion is welcomed...

Noam

0