assign output from C? Topic is solved

If you have a simple question and just want an answer.
Post Reply
jsaksris
Member++
Posts: 29
Joined: Wed Jul 04, 2018 4:06 pm

assign output from C?

Post by jsaksris »

How can we assign pin output from .c file?

As the <: syntax is not available.
as well as 'port' / 'on tile[]'


View Solution
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi. Rename your source code file to .xc and try again.

Which hardware kit are you using for this testing?

Which port pins are you attempting to drive with an output?

You can review the following:

http://www.xcore.com/viewtopic.php?f=3& ... led#p31562

if using the XCORE Audio board. Hope this helps.
jsaksris
Member++
Posts: 29
Joined: Wed Jul 04, 2018 4:06 pm

Post by jsaksris »

What I have found out that if I use a global variable between XC, and C by using extern keyword..
The variable end-up in a different address somehow(found this while debugging).

I have wrote an interface that would change the LEDs based on this value.
Since it's not the in the same address, the change in the value in C does not effect the one in XC.

I was desperate enough to try to change the LEDs directly from C file.. which is the part of the module_usb_audio > endpoint0 > endpoint0.c
I'm using the XCORE Audio board.. I'll dig into your thread tomorrow.

For those ran into this thread look for a way to interact between XC and C file.
you might find this useful.
http://www.xcore.com/viewtopic.php?t=1721
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

If you can rewrite your code in XC or make an XC wrapper for your C code I think you will be happier in the long run. Maybe your XC code can call a C function that returns the LED state or something, rather than using a global variable to talk between XC and C.
Post Reply