Seite 1 von 1

Problem bei der Programierung des TX Controllers in C

Verfasst: 27 Mär 2012, 15:09
von Martin S
Hallo

Ich hab folgende Frage
Wie kann ich einzelne Pixel des Displays anmachen?
Ich weiß von den Beispielen das man eine Art Message Box mit

Code: Alles auswählen

p_ta->hook_table.DisplayMsg(p_ta, "Nachricht");
aufrufen kann. Ich würde mich aber mal an einem Tetris versuchen wollen wo ich einzelne Pixel setzten muss versuchen.

Mfg Martin S

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 27 Mär 2012, 16:22
von vleeuwen
See (teil 2 version 1.4)
8.8 Struktur TA_DISPLAY

I guess that you must use the DISPLAY_FRAME struct to display bitmap images.
But this part is not realy documented.
You need to figure out how it works yourself.

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 27 Mär 2012, 17:07
von Martin S
Have you an idea how this could work?
I tested many but nothing did work.
I would be very lucky if you have a solution.

Mfg Martin S

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 27 Mär 2012, 18:33
von vleeuwen
I did not had time to test it but my hypothesis is:


DISPLAY_MSG.id=0; (do not make use of DISPLAY_MSG struct)

DISPLAY_FRAME.FRAME points to a 128*8 bytes array representing the bitmap (b/w).
DISPLAY_FRAME.is_pgm_master_of display= true
DISPLAY_FRAME.id=1 //probabely the change of this value will activate the transfer of the bitmap.
//
The bitmap will be transfer to the TX-C in parts (pages of 64 bytes).
The Transfer Area do not have more space available for the display information.
So there are 16 TA cycles needed to tranfsfer 1 bitmap.

I am expecting that the DISPLAY_MSG will be use by the transfer software to transfer the pages.

Let me know if this is working.

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 29 Mär 2012, 22:27
von Martin S
Hello
I´ve got this code now witch display me something like a big chaos.

Code: Alles auswählen

        unsigned char temp[64];
	p_ta->display.display_msg.id=0;
	p_ta->display.display_frame.is_pgm_master_of_display = 1;
	p_ta->display.display_frame.id=1;
	int z;
	for (z= 1;z <= 16;z++){
	p_ta->display.display_frame.frame=temp; 
	}
I expected to get a blank screen.

Mfg Martin

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 29 Mär 2012, 22:27
von Martin S
Mein Browser hat die letzt Nachricht doppelt gesendet.
Könnte das hier bitte jemand lösche.

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 29 Mär 2012, 23:17
von vleeuwen
Based on the documentation I am expecting that the
p_ta->display.display_frame.frame needs to contain a pointer to a 128*8 bytes array.
This array needs to contain representing the bitmap (b/w).

The split up of this array into parts will be done by the FtMscLib self.

Try to monitor the value of the id and the pointer.
Sorry that I don't have time to test this myself.


unsigned char * bitmapPointer;
unsigned char bitmap[128*8];
tempPointer=bitmap;

Don't forget to created the array itself.

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 30 Mär 2012, 17:01
von Ad2
@Martin S

Your code:

Code: Alles auswählen

        unsigned char temp[64];
   p_ta->display.display_msg.id=0;
   p_ta->display.display_frame.is_pgm_master_of_display = 1;
   p_ta->display.display_frame.id=1;
   int z;
   for (z= 1;z <= 16;z++){
   p_ta->display.display_frame.frame=temp; 
   }
Has some C errors. There is no assignment of entire arrays in C. var=temp; assigns the address of the array 'temp' to var, not the values in temp. Array indices in C start at 0, although you don't use 'z' as an index (why not?) it should normally look like "for (z=0;z<64;z++)". Furthermore your array temp likely contains random data.
On the positive side: At least something is happening.

Ad

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 01 Apr 2012, 18:54
von Martin S
I feel realy helpless now. :(

Here is my current code :

Code: Alles auswählen

int i;
int PrgTic
(
    TA * p_ta_array,    // pointer to the array of transfer areas
    int ta_count        // number of transfer areas in array (equal to TA_COUNT)
)
{
    int rc = 0x7FFF;
    TA * p_ta = &p_ta_array[TA_IDX]; 
	unsigned char * bitmap[64];
	int z;
	if(i==0){
	
		p_ta->display.display_msg.id=0;
		p_ta->display.display_frame.is_pgm_master_of_display = 1;
	
	}
	if(i<16){
		
		
		p_ta->display.display_frame.id=+1;
		p_ta->display.display_frame.frame=bitmap; 
		

	}
	i++;
	return rc;
}
I don´t know whats gone wrong.
I get a Chaos on the display and some pixels are blinking.
I would be very happy if i get some help. :D

Mfg Martin525

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 01 Apr 2012, 19:34
von vleeuwen
A couple of thinks in your code are not clear to me

1)
A bitmap is 128*64 bits (or 128*8 bytes).
-> Where is this bitmap defined in your code?
->What is the value of each pixel (bit, black or white)?

2)
What is the role of i?

Did you create a 128*8 byte array (allogate memory space for this array; with each byte =0)?

The TA description only ask for a pointer to an existing bitmap array (of 128*64 bits (128*8 bytes) and not 64*8 bytes).
And to increase the Id.
After that wait and see what will happen.

Re: Problem bei der Programierung des TX Controllers in C

Verfasst: 02 Apr 2012, 10:43
von Ad2
Hi,

I haven't tried myself but I have some comments on your code

Code: Alles auswählen

int i; //make this int i = 0;  variables should be initialised
int PrgTic
(
    TA * p_ta_array,    // pointer to the array of transfer areas
    int ta_count        // number of transfer areas in array (equal to TA_COUNT)
)
{
    int rc = 0x7FFF;
    TA * p_ta = &p_ta_array[TA_IDX]; //I guess TA_IDX is the index for your current TX controller
   unsigned char * bitmap[64]; //this defines an automatic array of 64 pointers to bytes and is NOT initialised, this is probably not you intend
   int z; //unused
   if(i==0){ //first time
   
      p_ta->display.display_msg.id=0;
      p_ta->display.display_frame.is_pgm_master_of_display = 1;
   
   }
   if(i<16){ //16 times
      
      
      p_ta->display.display_frame.id=+1;// not clear: =+ used to be an operator (deprecated), write: var = 1; or var += 1; depending on what you mean
      p_ta->display.display_frame.frame=bitmap; //this assigns the address of your array of pointers to the frame variable, the array is on the stack so both its address and 
                                                                       //contents may vary from invocation to invocation. recommendation: use a static array, eg.: static unsigned char bitmap[128];
                                                                       //and initialise it in eg. i==0. Or even easier, declare it globally, initialise it in the init function and update it in the tick function.
      

   }
   i++;
   return rc;
}