Adapting code! Works on AVR, need help with XMOS! :)

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
AtomSoft
XCore Addict
Posts: 135
Joined: Mon Dec 14, 2009 3:02 pm
Contact:

Post by AtomSoft »

Hey i altered the code and wanted you to test it but it doesnt seem to let me upload it...

Try this:

Code: Select all

void n6100_lcd_init()
{
	  n6100_lcd_reset();

	  // Display control
	  n6100_lcd_write_cmd(DISCTL);
	  n6100_lcd_write_data(0x00); 		// 2 divisions, Field swithcing period
	  n6100_lcd_write_data(0x20);   		// 132 lines to be display
	  n6100_lcd_write_data(0x00);   		// Inversely hightlighted lines - 1

	  n6100_lcd_write_cmd(COMSCN);  	// comscn
	  n6100_lcd_write_data(1);

	  n6100_lcd_write_cmd(OSCON);  		// oscon

	  n6100_lcd_write_cmd(SLPOUT);  	// sleep out

	  n6100_lcd_write_cmd(PWRCTR);  	// power ctrl
	  n6100_lcd_write_data(0x0f);      	// everything on, no external reference resistors
	  
	  n6100_lcd_write_cmd(DISINV);  	// display mode

	  n6100_lcd_write_cmd(DATCTL);  	// datctl
	  n6100_lcd_write_data(0x01);
	  n6100_lcd_write_data(0);
	  n6100_lcd_write_data(0x02);
	  
	  n6100_lcd_write_cmd(VOLCTR);  	// electronic volume, this is kinda contrast/brightness
	  n6100_lcd_write_data(0x20);       // this might be different for individual LCDs
	  n6100_lcd_write_data(0x03);    	  

	  n6100_lcd_delayus(1000);

	  n6100_lcd_write_cmd(DISON);    // display on
	
	 // wait 1ms 
	 n6100_lcd_delayus(10000);
}


User avatar
jason
XCore Expert
Posts: 577
Joined: Tue Sep 08, 2009 5:15 pm
Contact:

Post by jason »

For reference it probably didn't allow you to upload it as it was a disallowed file extension. If you zip it, it should allow you to add zip files. :-)
User avatar
AtomSoft
XCore Addict
Posts: 135
Joined: Mon Dec 14, 2009 3:02 pm
Contact:

Post by AtomSoft »

Thanks for the tip Jason, but i knew that heh also i used the Archive function in XMOS.. I think it may have been a ISP issue tho.. Ill try it again now...

EDIT: It worked now heh...
Attachments
tryme.zip
(37.96 KiB) Downloaded 315 times
tryme.zip
(37.96 KiB) Downloaded 315 times
User avatar
CaptainObvious
Member
Posts: 14
Joined: Wed Dec 30, 2009 12:24 pm

Post by CaptainObvious »

Thanks for takin the time to have a go! I did take some time today to rule out the hardware factor, make sure the IDE works, the pins work correctly, and most importantly that I was using the right ports/pins! Turns out the cable was a bit loose, had a connection like 60% of the time, but movements could break the connection.:/

So tightened the connectors and such, tested each pin and have no problems. But I'm still not able to get anything to display! I did also try some code for a HD44780 LCD.. but that also didn't work. The IDE cable seems fine.. I don't want to solder anything onto it just yet, but I might use some female-to-male jumpers just to rule it out.

I tried moving the ports as well, just to double check that.. but same thing, just a black screen. I checked the ports being used with some LEDs, all were correct.. so I'm lost again! (no surprise.) I'm still leaning towards user error, but I've debugged everything I've had problems with before on other microcontrollers.. there should be an XMOS-Spokane! (Washington state:))
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

CaptainObvious wrote: I tried moving the ports as well, just to double check that.. but same thing, just a black screen. I checked the ports being used with some LEDs, all were correct.. so I'm lost again! (no surprise.) I'm still leaning towards user error, but I've debugged everything I've had problems with before on other microcontrollers.. there should be an XMOS-Spokane! (Washington state:))
The screen should never be real black.
It should be blue-ish if the backlight is turned on. Is the backlight turned on?
User avatar
CaptainObvious
Member
Posts: 14
Joined: Wed Dec 30, 2009 12:24 pm

Post by CaptainObvious »

Yeah the backlight is on.. I suppose it is more of a blue-ish black, but definitely no pixels being used.
User avatar
CaptainObvious
Member
Posts: 14
Joined: Wed Dec 30, 2009 12:24 pm

Post by CaptainObvious »

Well.. I downgraded for a couple days to a HD44780 LCD.. just to try something a bit.. simpler. Well I tried for about 4 hours one night.. couldn't get it working.. so I called it a night.

Woke up the next day.. and I was like okay.. it's got to be hardware.. like I was thinkin earlier.. the IDE cables were kinda sketchy, so I ripped some out of my old computer, plugged everything in.. tried the sketch that AtomSoft uploaded, and boom, it's workin!

You sir, are a champ! Thanks a million! I must say, when you do get an XMOS board, you should be able to work out any problems with ease! :lol: Unless you're one of those people like me.. I can figure out other peoples problems fine.. but when I mess up, takes me ages to find it! :D


Thanks again, I'll take some pictures to show you shortly! It seems like the first column of pixels is just clear white when the BMP is printed, like it missed that spot, but I'll figure that out later!

Much appreciative,
Captain Ob(li)vious!
User avatar
AtomSoft
XCore Addict
Posts: 135
Joined: Mon Dec 14, 2009 3:02 pm
Contact:

Post by AtomSoft »

Heh Glad i could help friend! I learn a lot when i dont have the actual part because im forced to read without actually trying heh...

I learned some ARM to help this guy them i bought a LPC2148 bored. Played with it and never used it afterwards. I just like to try a new things i guess heh...

Anyway if you need any more help just post your heart out and if i cant help im sure someone else can... but i do hope i can heh...
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

CaptainObvious wrote: It seems like the first column of pixels is just clear white when the BMP is printed, like it missed that spot, but I'll figure that out later!
It's possible that this is a bug in my driver.
The controller does 132x132, the display 130x130, so two columns and rows are invisible.
Now i was convinced these were column/row 0 and 131 but it is possible that they are 130 and 131.
The document by Jamie P. Lynch also talks about 130 and 131.
User avatar
CaptainObvious
Member
Posts: 14
Joined: Wed Dec 30, 2009 12:24 pm

Post by CaptainObvious »

@Berni, you had it doing:
n6100_lcd_drawbitmap(1,1,130,130, bitmap);

Setting the first two to 0, 0, works great!

I've been trying for a bit to get the VDIP2 module to work, but I'm unable to read anything off of it when I use it in Parallel FIFO.. I'm able to use it in UART, but I've not been able to implement a good enough software UART.. always locks up the VDIP module, and requires a hardware reset.. and I haven't tried in SPI, not too familiar with that! But I'm able to use it fairly decent if I connect it to a UART-to-USB connector.. for simple commands, like open file.. write text to that file, close the file.. but haven't got into reading all the .raw data and doing anything with it.

But I'm happy to get this far! :D

Here are some examples, and heres the link to my Picasa if you want the "high def" pictures! I was surprised at how good they turned out:
http://picasaweb.google.com/jmcglo13/XM ... kia6610LCD

Image

Image

Image

Image
Post Reply