Jump to content

C function displayed as empty


Annatooli

Recommended Posts

I have some simple C functions, but suddenly I noticed all code is gone and functions are displayed as empty. I was worried, did I accidentally delete some of it, but luckily I have older versions so I opened these and copied content into notepad. But when I reopened newer file (file where c functions were empty) all content was back. I even saved newer file before opening older file.

So conclusion - C functions window displayed functions as empty, even when content actually did exists there.

Link to comment
Share on other sites

I really cant tell. But, today it happened again, with different PC. This time  when I downloaded program into PLC it told me, like I have changed all my C functions. But they wasn't even open that time. Again I closed - opened file and they where back once again.

Link to comment
Share on other sites

  • MVP 2023

Annatooli, I'd be interested to see if a complete dustout and wiggle/remove/reinsert every connection including ram on your puter would fix this.  Also do a serious check on your drives, check and also defrag them if not solid state.

If it's a laptop, you'd also be surprised how much gunk can get into cooling systems.  They need a good periodic clean, excess heat issues can cause havoc.

cheers, Aus.

Link to comment
Share on other sites

Certainly I don't have top notch PCs. 5th and 6th gen Intel i7, drives are Samsung 860 and 970 1TB.  Both has 16 GB RAM. One of them is water cooled, so yeah not top notch, but maybe they still manage to run Unilogic some how?

My windows install is minimal for running some windows specific programs like Unilogic. My main desktop is on Linux. 

Link to comment
Share on other sites

Maybe there is problem with my functions

One liner for swapping words

static void Swap_Bytes(unsigned int input, volatile unsigned int* result)
{
	// User code starts below this comment
	 *result = (unsigned int) ((input&0xffff0000)>>16) | ((input&0xffff)<<16);
	// User code ends above this comment
}

Thanks to @Saragani I was able to write this simple function for rising just one output in array.

static void Set_one_Bit_in_Array(volatile unsigned char* Arr, int ArrLen, unsigned char index)
{
	// User code starts below this comment
	int ndx = (int) index;
	
	for (int i=0; i < ArrLen; i++){
		if (i == ndx){
			Arr[i] = 1; // true
		}else{
			Arr[i] = 0; // false
		}
	}
	// User code ends above this comment
}

So these are my functions I cant tell what is wrong with them ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...