If you have carefully scanned the code and cannot see any statement that is not terminated with ‘;’ then there are possibly invisible characters in the code. Did you type it in or copy from somewhere? If it was copied, then paste the copy into a plain text editor such as Notepad and look for strange characters and delete them. VS Code is also useful for finding oddities. Or, for each line of code delete everything from the last character to the start of the next line and re-insert the line break.
If that’s not the problem post the code in the vicinity of the error and someone might look at it for you, but be aware that the actual problem might be some number of lines away from where it is reported.
It is essentially the same code with the actual display changed slightly. That means the two pieces of code cannot be compared to reveal what the problem with that first example might be. It also appears that the datasheet relies on the bitbanging code - for instance there is no mention of the I2C address of the device, which is required for the library version but is ignored in the bitbanging version.
If you want to pursue the library version (which IMHO is well worthwhile) then the place to start is confirming the address of the device. This utility will enable you to determine whether it really is at address 0x40 as the code assumes, or some other address.
I have tried this beforehand & all I get is no device found …
From another forum I have been told that the controller AIP1640 is NOT an I2C device as it does not follow the I2C spec. It does not have an address byte or ACK bits …
Looks like bitbanging is the way to go …
Just wonder why the datasheet has a hardware i2c example when it’s not a hardware i2c compatible device ?
I really appreciate your helping me , it is very kind of you!