PDA

View Full Version : Neat NKK OLED Rocker Switches - ASM Initialization



cc1984
- 21st May 2013, 12:28
I thought they were cool so I decided to include one in one of my projects......Might be sorry for the choice. I new from the beginning to keep it simple, but I just couldn't resist. So, after I read all the documentation and typed up my first, second, and third attempts to get it to function, I asked NKK for some example code for initialization. Good news, they gave me some! Bad news, it is in the foreign language of Assembly. So now either I figure out how to embed it in my program or I decipher it to PBP3. Any suggestions (other than learn Asm)? Their sample code is attached (I hope).

cc1984
- 21st May 2013, 14:24
Can anyone tell me if it looks like I am on the right track? This is the first part of the initialization translated from assembly to pbp.

INITOLR:

O_XCS = 0 'set lata.5 to low to select the OLED
O_AO = 1 'data sheet has set high for command (latc.6)
shiftout OSPI_DAT, OSPI_CLK,MSBFIRST,[$2]
O_AO = 0 'set low for data
shiftout OSPI_DAT, OSPI_CLK,MSBFIRST,[$0]
O_XCS = 1 'set a.5 high to delect the OLED
@ NOP

.....and all the rest.

cc1984
- 21st May 2013, 16:20
Well, I dusted off the assembly dust on my brain (6989) (I think) and converted to pbp. The display is still blank and off, but the internal switches work so I think I have it connected correctly. Using a PIC18F46K22 since the logic level for the display is ~3.3V. Assembly to PBP3 initialization code attached. Anybody got some ideas of what to try next?

http://www.nkkswitches.com/oled-rocker-switch.aspx