Programing on LED-Matrix

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

Post Reply
mhserrano
Posts: 45
Joined: Tue Dec 11, 2007 8:24 pm
Location: Torres Vedras, Portugal

Programing on LED-Matrix

Post by mhserrano »

Hi Good-Day,

I want to have on my code a function to switch on-off all the single led´s on my LED-Matrix, wich is actually an 8X8 matrix.

Can you explain what does it mean this single line on the code:

Code: Select all

	memset(&report, 0xff, IOWKIT_SPECIAL_REPORT_SIZE);
When i run the program with 0xff all the leds go on. But i dont understand how manipulate this to control precisely single leds on the matrix.

Thanks,

MS
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Re: Programing on LED-Matrix

Post by Guido Körber »

You are filling the report buffer with $ff. If you want to control individual LEDs you need to set individual bits.
User avatar
Christoph Jung
Posts: 670
Joined: Sun Oct 08, 2006 3:43 pm
Location: Germany / Berlin
Contact:

Re: Programing on LED-Matrix

Post by Christoph Jung »

memset will be used to fill the variable "report" with values 0xff. This is NOT to write to the IO-Warrior. It will be used to clean old values or reset the variable.
Abteilung: Softwareentwicklung
Folge uns auf Twitter
Follow us on twitter
mhserrano
Posts: 45
Joined: Tue Dec 11, 2007 8:24 pm
Location: Torres Vedras, Portugal

Re: Programing on LED-Matrix

Post by mhserrano »

Ok thanks i understood,

memset is not the "point" i need! Please can you give me an example (with C++ code) to set an individual led ON, on a matrix of 8X8?

Actually i can do that, but using memset on this code:

Code: Select all

void CInterfaceSystemDlg::OnCHECK1writebit1() 
{
	// TODO: Add your control notification handler code here
	IOWKIT_SPECIAL_REPORT report;

	memset(&report, 0x30, IOWKIT_SPECIAL_REPORT_SIZE);

	report.ReportID = 0x15;

	report.Bytes[0] = 0x01;

	IowKitWrite(ioHandle, IOW_PIPE_SPECIAL_MODE, (PCHAR) &report, IOWKIT_SPECIAL_REPORT_SIZE);
}



With this i can put only one segment of 7SD to ON! But i dont know if this is the correct way!

Thanks in advance,

MS
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Re: Programing on LED-Matrix

Post by Guido Körber »

memset is filling every single byte of the data structure with the same value.

What you are doing is giving you the intended result just by chance.
mhserrano
Posts: 45
Joined: Tue Dec 11, 2007 8:24 pm
Location: Torres Vedras, Portugal

Re: Programing on LED-Matrix

Post by mhserrano »

Ok,

I have told you before i´m not an expert on programing languages.

I have experimented another code and i can switch on-off a single led:

Code: Select all

void CInterfaceSystemDlg::OnCHECK1writebit1() 
{
	// TODO: Add your control notification handler code here
	IOWKIT_SPECIAL_REPORT report;
	
	report.ReportID = 0x15;
	
	report.Bytes[0] = 0x01;

	report.Bytes[1] = 0x80;

	IowKitWrite(ioHandle, IOW_PIPE_SPECIAL_MODE, (PCHAR) &report, IOWKIT_SPECIAL_REPORT_SIZE);
	
}
Can i use it?

Thx,

MS
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Re: Programing on LED-Matrix

Post by Guido Körber »

Yes, that works. If you want to manipulate single matrix positions you need to access individual bits of the matrix data.
Post Reply