Monday, September 21, 2009

simple oscilloscope using Z8F0823 and N3310 LCD

Do-it-yourself simple oscilloscope using Zilog Z8F0823 and Nokia 3310 LCD.

diagram:
demo:


sample "main.c" source code:
 #include <ez8.h>  
#include "delay.c"
#include "lcd3310.c"
void erase_column(char x);
void lcd_pixel (char x, char y);
void lcd_vertical_line (char x, char y1, char y2);
void main()
{
char x, y1, y2, samples[84];
//setup ADC
PBDD |= 0x01; // PB0 input direection
PBAF |= 0x01; // PB0 Alernate function on
PBAFS1 |= 0x01; // PB0 analog input
ADCCTL1 |= 0x80; // 2V Vref
ADCCTL0 |= 0x10; // Set ADC Control Register; continuous
//initialize 3310 LCD
lcd_init();
lcd_clear();
//display sample alphanumerics
lcd_gotoxy(0,1);
lcd_puts("DIY scope");
lcd_gotoxy(0,2);
lcd_puts("Zilog Z8F0823");
lcd_gotoxy(0,3);
lcd_puts("Nokia 3310 LCD");
lcd_gotoxy(0,5);
lcd_puts("yus - elab.ph");
delay_ms(3000);
while(1)
{
//store samples
for(x=0; x<=84; x++)
{
samples[x] = ADHR; //read ADC value (high byte)
delay_us(100); //adjust this delay to vary the sampling frequency
}
//plot samples
erase_column(0);
for(x=0; x<=84; x++)
{
erase_column(x+1);
y1 = samples[x] / 2.5; //scale to {0..47} range
y1 = 47 - y1; //invert position (optional)
y2 = samples[x+1] / 2.5; //scale to {0..47} range
y2 = 47 - y2; //invert position (optional)
//lcd_pixel(x,y1);
lcd_vertical_line(x,y1,y2); //plot
}
delay_ms(50);
}
}
void erase_column(char x)
{
char line;
if(x>83) return;
for(line=0; line<6; line++)
{
lcd_gotoxy(x, line);
lcd_send(0x00, LCD_TDATA);
}
}
void lcd_pixel (char x, char y)
{
char data;
if ((x > 83) || (y > 47)) return;
data = 0x01<<(y%8);
lcd_gotoxy(x, (y>>3));
lcd_send(data, LCD_TDATA);
}
void lcd_vertical_line (char x, char y1, char y2)
{
char i, temp, line1, line2, data;
if( (x>83) || (y1>47) || (y2>47) ) return; //exit if out of range
if(y1>y2)
{
temp = y1;
y1 = y2; //swap variables
y2 = temp;
}
line1 = y1>>3; //divide by 8
line2 = y2>>3;
for(i=line1; i<=line2; i++)
{
data = 0xff;
lcd_gotoxy(x,i);
if(i==line1)
{
data = 0;
temp = 8 - (y1 % 8);
while(temp--) data |= (0x80>>temp);
}
if(i==line2)
{
temp = 7 - (y2 % 8);
while(temp--) data &= ~(0x80>>temp);
}
lcd_send(data, LCD_TDATA);
}
}

complete code and diagram here: N3310 LCD Oscilloscope using Z8F0823.rar

Saturday, September 19, 2009

Wireless LCD

Wireless LCD using Nokia 6100/6610 colored LCD, National Semiconductor's LMX9838 Bluetooth SPP module and Zilog's Z8F082A MCU.

demo:

more info: Wireless LCD

N3310 LCD Image Encode

Nokia 3310/5110 LCD Image(full screen) Encoder -> generates HEX array equivalent of the input images. supports JPG, BMP and GIF files.

simple code usuage:
 lcd_gotoxy(0,0);  
for(i=0; i<504; i++) lcd_send(image[i],LCD_TDATA);

download: 3310 Image Encoder.exe
*requires dotNET 3.5

simulation:
sample circuit using N5110LCD:

Friday, September 18, 2009

Spinning LEDs Display

Spinning LEDs Display using PIC16LF73 (SSOP) and 7 SMT LEDs:
complete assembly and synchronizing mechanism:

demo:


additional info: Another Spinning LED Display

LC meter (PIC16F876A & N3310LCD)

Inductance/Capacitance meter using PIC16F876A and Nokia 3310 LCD.
..as inspired by these two projects:
A Surprisingly Accurate Digital LC Meter
Digital LC Meter Version 2




Schematic:
demo:


source code: LC meter pic16f876A (initial) 032609.rar
(*contains basic functions but not anymore updated)

##########################################################

edit(01-01-10):
source code with MPLAB(8.4) Project (*.mcp):
LC meter pic16f876A (diagram and source code).rar

generated hex using HI-TECH C Compiler v9.63:
:10000000F501F601F701F801F901FA01FB01FC0124
:10001000FD010A128A110C280A168A1189248312FA
:10002000C901CA0100300A168A119427A001A10152
:10003000CC01CC0A0C3020078400023003180330B6
:1000400021070A128A1100220A168A11E5250A12CE
:100050008A11A00A0319A10A2108803AA20081305E
:100060002202031D3528F8302002031C1828053011
:10007000C900CA0128300A168A119427CA30BF0065
:100080000730C0000A168A11E727C830C700C80128
:100090000A128A15A1270A128A15DE260A168A1163
:1000A0009D240A128A11061C5B280A128A15FF2455
:1000B0000A128A115E280A128A152B2101300A16AB
:1000C0008A11BE271E30C700C8010A128A15A1274F
:1000D00000300A168A11BE271430C700C8010A1260
:0A00E0008A15A1270A128A1153287D
:10040000FE00FE1F082A83137E18831700080800C9
:100410008A0004088200003400344034C034C03400
:10042000803480340034003400340034003400342C
:10043000003400340034003400340034003400341C
:10044000003400340034003400340034003400340C
:1004500000340034003400340034003400340034FC
:1004600000340034003400340034003400340034EC
:1004700000340034003400340034003400340034DC
:100480000034E034F834F034E03400340034003424
:100490000034E034E034E034C034803410347C3450
:1004A000FC34FE34FC34F834E034C034003400341E
:1004B000003400340034003400340034003400349C
:1004C00000340034013407341F347F34FC34F834F2
:1004D000E03480340034003400340034FC34FE3422
:1004E000FC34DC34183438347034E0348034003474
:1004F000003400340034003400340034003400345C
:10050000003480340034003480348034803400344B
:100510008034C034C034C03480348034003400347B
:10052000F034F834F83478347034F034CF349F3405
:100530003F347F34FF34F634C03487347F34FF34A3
:10054000FF34E7349F34FC34FB34FF34FF34FF3492
:10055000FF34FF34DF341834003400340034003406
:1005600000340034003400340034003400340034EB
:1005700000340034013403340F347F34FE34F83453
:10058000E0348034003407343F34FF34FE34FC342C
:10059000E034013403340F340434003400340034C4
:1005A00000340034003403340F343F34FF34FF345C
:1005B000FF34E7341F347F34FF34FF34F334CF3457
:1005C0003F34FF34FE34F834E3349F347F34FF3457
:1005D000FC34FF34DF341F340F340E34C334CF34D3
:1005E0003F34FF34FE34F934C7341F347F34FF34D2
:1005F000FF34F334833403342134E734DF34FF34FD
:10060000FC34F034C034003400340034003400349E
:10061000003400340034003400340034003400343A
:1006200000340034013403340F343F34FE34F834E2
:10063000E0348034013407341F34FF34FE34F8349E
:10064000E0348034003404341C34F834F034803422
:1006500000340034013403340F343F34FF34FE34AB
:10066000F934E7349F347F347F347C347134073479
:100670003F343F341E341D340134033407340F3407
:100680000E340E340C340F340F3400340134033480
:1006900007340F340E340F340734033407340E3468
:1006A0001E343D343F343F34193407341F347F3413
:1006B0007E347834C03400340034003400340034E4
:1006C000003400340034003400340034003400348A
:1006D00000340034003403340F343F34FE34F83433
:1006E000F0348034013407340F349F34FF347C34C9
:1006F000F834F034F734FF347E34003400340034FE
:100700000034003400340134013400340034003447
:100710000034003400340034003400340034003439
:100720000034003400340034003400340034003429
:100730000034003400340034003400340034003419
:100740000034003400340034003400340034003409
:1007500000340034003400340034003400340034F9
:1007600000340034003400340034003400340034E9
:1007700000340034003400340034003400340034D9
:1007800000340034003403340F343F34FE34FE347C
:100790007F343F341F340C340034003400340034D0
:1007A00000340034003400340034003400340034A9
:1007B0000034003400340034003400340034003499
:1007C0000034003400340034003400340034003489
:1007D0000034003400340034003400340034003479
:1007E0000034003400340034003400340034003469
:1007F0000034003400340034003400340034003459
:100800000034003400340034003400340034003448
:100810000034003400342F34003400340034073402
:1008200000340734003414347F3414347F341434E7
:1008300024342A347F342A341234233413340834D1
:1008400064346234363449345534223450340034FC
:10085000053403340034003400341C342234413471
:1008600000340034413422341C340034143408344D
:100870003E3408341434083408343E340834083420
:100880000034003450343034003410341034103418
:1008900010341034003460346034003400342034B8
:1008A00010340834043402343E345134493445346D
:1008B0003E34003442347F344034003442346134B6
:1008C0005134493446342134413445344B34313485
:1008D0001834143412347F341034273445344534FA
:1008E000453439343C344A344934493430340134A1
:1008F00071340934053403343634493449344934C5
:10090000363406344934493429341E3400343634FC
:100910003634003400340034563436340034003475
:10092000083414342234413400341434143414346C
:10093000143414340034413422341434083402346E
:100940000134513409340634323449345934513481
:100950003E347E341134113411347E347F344934C2
:100960004934493436343E344134413441342234FC
:100970007F344134413422341C347F344934493487
:10098000493441347F3409340934093401343E3464
:100990004134493449347A347F34083408340834D3
:1009A0007F34003441347F344134003420344034C7
:1009B00041343F3401347F34083414342234413418
:1009C0007F3440344034403440347F3402340C347B
:1009D00002347F347F340434083410347F343E349E
:1009E0004134413441343E347F34093409340934CC
:1009F00006343E344134513421345E347F3409347A
:100A0000193429344634463449344934493431346C
:100A1000013401347F34013401343F3440344034F4
:100A200040343F341F342034403420341F343F34AA
:100A30004034383440343F3463341434083414348C
:100A40006334073408347034083407346134513463
:100A500049344534433400347F3441344134003424
:100A600055342A3455342A34553400344134413411
:100A70007F3400340434023401340234043440340A
:100A800040344034403440340034013402340434BF
:100A90000034203454345434543478347F3448345B
:100AA00044344434383438344434443444342034C2
:100AB00038344434443448347F343834543454342F
:100AC0005434183408347E340934013402340C347C
:100AD0005234523452343E347F34083404340434B3
:100AE0007834003444347D3440340034203440348D
:100AF00044343D3400347F341034283444340034DA
:100B0000003441347F34403400347C3404341834AD
:100B1000043478347C34083404340434783438347D
:100B200044344434443438347C3414341434143469
:100B3000083408341434143418347C347C340834C5
:100B40000434043408344834543454345434203491
:100B500004343F344434403420343C344034403452
:100B600020347C341C342034403420341C343C3455
:100B70004034303440343C34443428341034283445
:100B800044340C345034503450343C3444346434A1
:100B900054344C34443400340034003400340034D1
:100BA000003400340034003400340034FC34FC34AD
:100BB000C034C034C034FC34FC340034003400345D
:100BC0000034003400340034003400340034003485
:100BD0001F341F340034003400341F341F34E03419
:100BE000E034C0346034E034E034C0346034E034A5
:100BF000C0340034FC34FC34C034C034C034FC3461
:100C0000FC341F341F34003400341F341F340034CC
:100C100000341F341F3400341F341F3400340034B8
:100C200000341F341F34003400340034E034E03426
:100C300000340034E034E03400340034FC34FC345C
:100C4000C034C034C034FC34FC34003400340034CC
:100C5000FF34FF34183408341F341F340034003498
:100C60001F341F340034003400341F341F34003468
:100C700000340034E034E034C0346034E034C03454
:100C800000340034FC34FC34C034C034C034FC3490
:100C9000FC340034003400341F341F34003400347A
:100CA0001F341F34003400341F341F340034003428
:100CB00000341F341F34E034E034C0346034E03496
:100CC000E034C0346034E034C03400340034FC34E8
:100CD000FC34CC34CC34CC340C341F341F340034CA
:100CE00000341F341F34003400341F341F340034E8
:100CF00000341F341F340034003400340034003416
:100D0000003400340034E034E03400340034E034A3
:100D1000E03400340034FC34FC34CC34CC34CC34F7
:100D20000C340034003400340034FF34FF34183401
:100D300008341F341F34003400341F341F3400348F
:100D40000034003400340034003400340034E03423
:100D5000E034C0346034E034C03400340034FC3457
:100D6000FC34CC34CC34CC340C3400340034003477
:100D700000341F341F34003400341F341F34003457
:100D800000341F341F340034003400340034003485
:100D9000003400340034E034E03460346034E03453
:100DA000C03400340034FC34FC34CC34CC34CC3487
:100DB0000C340034003400340034FF34FF34183471
:100DC00018341F340734003400341F341F34003407
:100DD000003400340034FC34FE34FE34063406346F
:100DE000FE34FE34FC347F34FF34FF34C034C0346E
:100DF000FF34FF347F34003418341C34FE34FE34A6
:100E0000FE340034003400340034C034FF34FF3486
:100E1000FF34C03400343C343E343E34063486342F
:100E2000FE34FE347C34E034F034FC34FF34CF3410
:100E3000C734C134C0341C341E349E3486348634E6
:100E4000FE34FE34FC347834F834F934C134C1341F
:100E5000FF34FF347E340034F034FE347E34FE340C
:100E6000FE34FE3400343F343F3437343034FF3402
:100E7000FF34FF343034FE34FE34FE34C634C6341E
:100E8000C634C63486347134F134F134C034C034DD
:100E9000FF34FF347F34FC34FE34FE34C634C634B1
:100EA000DE34DE349C347F34FF34FF34C034C0344D
:100EB000FF34FF347F340634063406348634E63497
:100EC000FE347E341E348034F034FE343F34073434
:100ED0000134003400347C34FE34FE3486348634ED
:100EE000FE34FE347C347E34FF34FF34C134C134EC
:100EF000FF34FF347E34FC34FE34FE3486348634D2
:100F0000FE34FE34FC347834F934F934C134C1345D
:100F1000FF34FF347F3470346C346534613473349F
:100F20006534203477346134693474342E342E348B
:100F30000034203469346E3464347534633474346A
:100F400061346E34633465342034003443346134A6
:100F50006C346934623472346134743469346E349C
:100F600067342E3400342034633461347034613497
:100F700063346934743461346E34633465340034FA
:100F800020342034203420342034203420342034C1
:100F90002034003459345534533427343034393400
:020FA00000341B
:101256000530C900CA0107300A168A119427993049
:10126600BF000730C0000A168A11E7270A128A153E
:101276005A273E08B0003D08AF003008BE002F08D0
:10128600BD00C0260A128A153D08FB003E08FC0078
:101296003F08FD007B08C0007C08C1007D08C20035
:1012A6007508BD007608BE007708BF00942675084D
:1012B60003186329FB007608FC007708FD00750813
:1012C600C0007608C1007708C2007508BD00760820
:1012D600BE007708BF00D3223D08A9003E08AA0039
:1012E6003F08AB007508C0007608C1007708C20049
:1012F6007508BD007608BE007708BF00D3223D08FA
:10130600AC003E08AD003F08AE007B08C0007C087C
:10131600C1007D08C2007B08BD007C08BE007D08B8
:10132600BF00D3223D08A3003E08A4003F08A50045
:101336002308C0002408C1002508C2002C08BD00EF
:101346002D08BE002E08BF00CE230A128A153D08BE
:10135600A6003E08A7003F08A8007808C000790844
:10136600C1007A08C2007808BD007908BE007A0874
:10137600BF00CE230A128A153D08C0003E08C100F0
:101386003F08C2002908BD002A08BE002B08BF007E
:10139600CE230A128A153D08C0003E08C1003F0848
:1013A600C2002608BD002708BE002808BF00D322B9
:1013B6004030C0001C30C1004630C200D3223D0878
:1013C600B4003E08B5003F08B6007508C0007608B0
:1013D600C1007708C2007508BD007608BE00770810
:1013E600BF00D3227808C0007908C1007A08C2007D
:1013F600D3227808C0007908C1007A08C200D32237
:101406007B08C0007C08C1007D08C200D3227B088F
:10141600C0007C08C1007D08C200D3223630C0005F
:101426001A30C1004730C200D3223D08B1003E0841
:10143600B2003F08B3003108C0003208C1003308CB
:10144600C2003408BD003508BE003608BF00382388
:101456003D08BD003E08BE003F08BF006030C0002A
:101466006330C1005830C200D3223D08B7003E08A1
:10147600B8003F08B9003708C0003808C10039086D
:10148600C200C030BD007930BE004430BF00942693
:101496000318A92A3708C0003808C1003908C20055
:1014A600E630BD007330BE004930BF0094260318F5
:1014B600952A3708C0003808C1003908C2002E3006
:1014C600BD006E30BE004E30BF0094260318802A41
:1014D6006B30C0006E30C1004E30C2003708BD0010
:1014E6003808BE003908BF0038233D08B7003E085B
:1014F600B8003F08B9000030AA2A2430C000743072
:10150600C1004930C2003708BD003808BE0039089E
:10151600BF0038233D08B7003E08B8003F08B900B1
:101526000130AA2AC0017A30C1004430C20037080F
:10153600BD003808BE003908BF0038233D08B70093
:101546003E08B8003F08B9000230AA2A03300A163E
:101556008A11E9240A128A15C001C830C100423036
:10156600C2003708BD003808BE003908BF00D322C4
:101576003D08B7003E08B8003F08B9003708BD006F
:101586003808BE003908BF00B5273E08B0003D0840
:10159600AF003008BE002F08BD000A168A112F2E94
:1015A600C601C701C8014430CF003D309423C300B3
:1015B6004530CF0040309423C306C508031DC40838
:1015C600031DEC2A4608BD004708BE004808BF00B8
:1015D600080045087B3EC4070730C5003D1C012BAB
:1015E6004008C607410803110318410A031DC7072F
:1015F600420803110318420A031DC8070310BF0C53
:10160600BE0CBD0C0310C00DC10DC20DC50BF12AD9
:101616000930C5003D1C1D2B4008C60741080311B3
:101626000318410A031DC707420803110318420A9B
:10163600031DC8070310BF0CBE0CBD0C0310C80C5D
:10164600C70CC60CC50B0D2B44088313CF004630C0
:101656008924C3080319312B8030C8044608BD000D
:101666004708BE004808BF000800C701C801C901F5
:101676004530CF003D309423C400C508031D4A2BD6
:101686004708BD004808BE004908BF0008004330AF
:10169600CF0040309423C600C308031D592B4708CA
:1016A600BD004808BE004908BF0008004308893E3F
:1016B600CA00C5024608C4061830C6000310C70D86
:1016C600C80DC90D42083F02031D6F2B41083E029B
:1016D600031D6F2B40083D02031C7E2B4008BD02F4
:1016E6004108031C410FBE024208031C420ABF0206
:1016F6000130C7040310BD0DBE0DBF0DC60B612B17
:1017060045088313CF0047308924C40803198D2B5D
:101716008030C9044708BD004808BE004908BF001C
:101726000800D000840083130008D200840A000851
:10173600D300840A0008D4000310530D540DD100C1
:10174600D5004F08840055088000D108031DB42B2E
:101756005008840000308001840A8001840A8001D8
:101766000800D10150088400840A80308004840A6D
:10177600500884000008D200840A0008D300840AB6
:101786000008D400D41BD10A50088400840A840AB5
:101796008001510808008030C2064008C600410892
:1017A600C7004208C8003D08C3003E08C4003F0801
:1017B600C500E4234308BD004408BE004508BF0039
:1017C60008004D30CF0043309423CB00CD08031DD5
:1017D600F32B4608C3004708C4004808C5000800A4
:1017E6004C30CF0046309423C900CC0803197F2C17
:1017F6000630CA004C084D020318262C4C08CE00B1
:101806004D08CE0219304E02031C122CC301C4012E
:10181600C5014C08CD004908CB004B2C0310C60D62
:10182600C70DC80DCC034C084D0603191C2CCA0B5A
:10183600112C4D084C0603194B2C0310C50CC40C77
:10184600C30CCD0A1C2C4D084C0603194B2C4D0815
:10185600CE004C08CE0219304E02031C372CC601AE
:10186600C701C8014B2C0310C30DC40DC50DCD0314
:101876004C084D060319412CCA0B362C4D084C0654
:1018860003194B2C0310C80CC70CC60CCC0A412CF0
:10189600CB080319572CFF30C306C406C506C30A76
:1018A6000319C40A0319C50AC9080319632CFF30B2
:1018B600C606C706C806C60A0319C70A0319C80A10
:1018C600CB014608C307470803110318470A031D3F
:1018D600C407480803110318480A031DC507C51F96
:1018E6007F2CFF30C306C406C506C30A0319C40A03
:1018F6000319C50ACB01CB0A4D08CF004330892412
:10190600CB08031908008030C5060800D000CF08B0
:1019160003199C2C5008840083130008D100840A04
:101926000008D200840A0008D30052045104031DA3
:10193600B02C50088400003083138001840A800193
:10194600840A80010800CF0A5008023E8400031072
:10195600800C8403800C8403800C5008023E8400B3
:10196600FE3000050319D12CA62CCF0A500884009E
:1019760001308007840A00300318013E031D8007EA
:10198600840A00300318013E80075008023E840096
:101996000310800C8403800C8403800C5008023EE4
:1019A600840000080319E12CB82CCF0350088400EA
:1019B6000310800D840A800D840A800D500A84006D
:1019C600801FD82C4F18EE2C50088400840A7F30D4
:1019D6008005840AFF300310CF0C4F08D300D201D4
:1019E600D1015008840051088004840A52088004FA
:1019F600840A5308800408000530C900CA0107306C
:101A06000A168A119427B330BF000730C0000A16A1
:101A16008A11E7270A128A155A273E08B9003D0897
:101A2600B8003908BE003808BD00C0260A128A155B
:101A36003D08FB003E08FC003F08FD007B08C00097
:101A46007C08C1007D08C2007508BD007608BE008E
:101A56007708BF00942675080318372DFB00760813
:101A6600FC007708FD007508C0007608C1007708FD
:101A7600C2007508BD007608BE007708BF00D322F5
:101A86003D08A6003E08A7003F08A8007508C0004C
:101A96007608C1007708C2007508BD007608BE004A
:101AA6007708BF00D3223D08A9003E08AA003F08D8
:101AB600AB007B08C0007C08C1007D08C2007B0823
:101AC600BD007C08BE007D08BF00D3223D08A300F0
:101AD6003E08A4003F08A5002308C0002408C10052
:101AE6002508C2002908BD002A08BE002B08BF0031
:101AF600CE230A128A153D08B2003E08B3003F08FD
:101B0600B4003208BD003308BE003408BF007808B0
:101B1600C0007908C1007A08C200D3223D08AF0090
:101B26003E08B0003F08B1002F08BD003008BE00D7
:101B36003108BF007808C0007908C1007A08C200E1
:101B4600D3223D08AC003E08AD003F08AE002C088D
:101B5600BD002D08BE002E08BF00C0017A30C100AE
:101B66004430C200D3223D08B5003E08B6003F0807
:101B7600B7007808C0007908C1007A08C200780862
:101B8600BD007908BE007A08BF00D3223D08C00018
:101B96003E08C1003F08C2002608BD002708BE0057
:101BA6002808BF00CE230A128A153D08BD003E084C
:101BB600BE003F08BF007B08C0007C08C1007D084E
:101BC600C200D3227B08C0007C08C1007D08C20089
:101BD600D3223D08C0003E08C1003F08C2003508B8
:101BE600BD003608BE003708BF0038233D08BA00DE
:101BF6003E08BB003F08BC003A08C0003B08C100D5
:101C06003C08C200C030BD007930BE004430BF0081
:101C1600942603186A2E3A08C0003B08C1003C0807
:101C2600C200E630BD007330BE004930BF009426C6
:101C36000318562E3A08C0003B08C1003C08C200F3
:101C46002E30BD006E30BE004E30BF009426031805
:101C5600412E6B30C0006E30C1004E30C2003A08D3
:101C6600BD003B08BE003C08BF0038233D08BA0053
:101C76003E08BB003F08BC0004306B2E2430C00079
:101C86007430C1004930C2003A08BD003B08BE00AE
:101C96003C08BF0038233D08BA003E08BB003F0899
:101CA600BC0005306B2EC0017A30C1004430C20042
:101CB6003A08BD003B08BE003C08BF0038233D087B
:101CC600BA003E08BB003F08BC0006306B2E07304A
:101CD6000A168A11E9240A128A15C001C830C10001
:101CE6004230C2003A08BD003B08BE003C08BF00B7
:101CF600D3223D08BA003E08BB003F08BC003A08A4
:101D0600BD003B08BE003C08BF00B5273E08B90031
:101D16003D08B8003908BE003808BD000A168A1109
:101D26002F2EBF1FA32E3D08003CBD003E08031CFE
:101D36003E0A003CBE003F08031C3F0A803CBF0031
:101D4600C21FB22E4008003CC0004108031C410AD5
:101D5600003CC1004208031C420A803CC20080309D
:101D6600BF06C20642083F02031D080041083E02A4
:101D7600031D080040083D0208003E083D04031DFF
:101D8600C82EBD01BE01BF0108003D08C3003E08C4
:101D9600C400C5014308C0004408C1004508C2008C
:101DA6008E30CF00403089244008BD004108BE0077
:101DB6004208BF0008000A168A119D24C901C90AF3
:101DC600CA0101300A168A119427A630BF000730CF
:101DD600C0000A168A11E7270330C900CA0101307C
:101DE6000A168A1194278B30BF000730C0000A16E6
:101DF6008A11E7270A128A1507105A273E08BE00DD
:101E06003D08BD00C0260A128A153D08F5003E08A9
:101E1600F6003F08F7003230C700C801A1275A274D
:101E26003E08BE003D08BD00C0260A128A153D08C0
:101E3600F5003E08F6003F08F70007145A273E084B
:101E4600BE003D08BD00C0260A128A153D08F800EE
:101E56003E08F9003F08FA003230C700C801A12742
:101E66005A273E08BE003D08BD00C0263D08F800C2
:101E76003E08F9003F08FA0007100430C900CA01FD
:101E860000300A168A119427A301CC01CC0AFC3033
:101E96000A168A11E5250A128A150230C700C801FA
:101EA600A127A30A5430230203180800482F0B1158
:101EB6008316051202308312C700C801A1278101CB
:101EC6000A30C700C801A127831605168312010828
:101ED600BF00C001C101C201772F013042020030AC
:101EE6000319410203188D2F831601160000000006
:101EF6000112000000008312C10A0319C20A010878
:101F0600C300C40140084406031D8B2F3F08430647
:101F16000319702F3F08C400C30141084302C500DE
:101F26004208031C420A4402C6004508003EBD00A2
:101F360046080318013E013EBE0008004130CA00B3
:101F4600EE30C900C90BA52FCA0BA52F640083125A
:101F560003130130C702031CC803480847040319CA
:101F66000800A12F4230CF003D309423C1003D0828
:101F7600C3003E08C4003F08C500C6018E30C20239
:101F8600C21FD72F4208803A8F3E0318CF2FBD01BC
:101F9600BE01BF01C00108000310C60CC50CC40C6D
:101FA600C30CC20FCF2FE92F20304202031CE62FAD
:101FB600BD01BE01BF01C00108000310C30DC40D61
:101FC600C50DC60DC203C208031DE02FC1080319C3
:101FD600F72FC309C409C509C609C30A0319C40AE8
:101FE6000319C50A0319C60A4608C0004508BF00FA
:0A1FF6004408BE004308BD000800C7
:10291200053083169C00CF30850081160116811187
:10292200011581140114B4240A168A119D248316F8
:102932000614071081130800C901CA010030942748
:102942000A168A11A401A501CC01CC0A0030E525A2
:10295200A40A0319A50A01302502F830031924023A
:1029620003180800A52C870183128230A400DD30F1
:10297200A300A30BBA2CA40BBA2CBF2C0000831209
:1029820003138712000007160000871000000715C6
:10299200000087118230A400DD30A300A30BCF2CEE
:1029A200A40BCF2CD42C831203138715CC01213016
:1029B200E525CC01C830E525CC010630E525CC0162
:1029C2001330E525CC012030E525CC010C30E52D76
:1029D200BD000230C900CA013C3094270A168A1190
:1029E200BE012430C500C6013D088313C300C401E3
:1029F2004C25CB30BF000530C0003E083F07C10068
:102A02000030031801304007C20041084307840028
:102A120042080318013E44070A128A1100220A16CC
:102A22008A11CC01CC0AE525BE0A12303E02031CF3
:102A3200F22C0330C900CA013C3094270A168A11CD
:102A42001230BE002430C500C6013D088313C30006
:102A5200C4014C25CB30BF000530C0003E083F0703
:102A6200C1000030031801304007C200410843078B
:102A7200840042080318013E44070A128A11002208
:102A82000A168A11CC01CC0AE525BE0A24303E0280
:102A920003180800232DC701C801431C562D450801
:102AA200C7070318C80A4608C8070310C50DC60D94
:102AB2000310C40CC30C44084304031D4E2D4808E4
:102AC200C4004708C3000800C1007B30410203185C
:102AD200080020304102031C08000530C500C60171
:102AE20041088313C300C4014C25643043078400AA
:102AF20003300318043044070A128A1100220A160E
:102B02008A11CC01CC0AE5250530C500C601410871
:102B12008313C300C4014C2565304307840003308E
:102B22000318043044070A128A1100220A168A1175
:102B3200CC01CC0AE5250530C500C6014108831346
:102B4200C300C4014C2566304307840003300318D8
:102B5200043044070A128A1100220A168A11CC0193
:102B6200CC0AE5250530C500C60141088313C30020
:102B7200C4014C2567304307840003300318043036
:102B820044070A128A1100220A168A11CC01CC0AC1
:102B9200E5250530C500C60141088313C300C40101
:102BA2004C2568304307840003300318043044077F
:102BB2000A128A1100220A168A11CC01CC0AE525D2
:102BC200CC01CC0A0030E52DCD008714CC080319C6
:102BD2008710000007110000871200000712CD1BAA
:102BE20007160000871600008712000007124D1B0F
:102BF2000716000087160000871200000712CD1A80
:102C020007160000871600008712000007124D1AEF
:102C12000716000087160000871200000712CD1960
:102C220007160000871600008712000007124D19D0
:102C32000716000087160000871200000712CD1841
:102C420007160000871600008712000007124D18B1
:102C52000716000087160000071508000230C90099
:102C6200CA01003094270A168A11C030BF0007300B
:102C7200C000E7270330C900CA01003094270A16B2
:102C82008A11C030BF000730C000E7270330C900F7
:102C9200CA01233094270A168A11CC01CC0A70305B
:102CA200E525CC01CC0A7030E525CC01CC0A703088
:102CB200E5251030C1002730C2003E08C0003D08A3
:102CC200BF00E92640083F040319762E1030C100E8
:102CD2002730C2003E08C0003D08BF00E9263F0879
:102CE200C0000530BF0003301427E830C1000330B4
:102CF200C2003E08C0003D08BF00E9264008C000EF
:102D02003F08BF000A30C100C2019E2740083F04AD
:102D1200031D982E1030C1002730C2003E08C000AB
:102D22003D08BF00E92640083F040319AF2EE830F2
:102D3200C1000330C2003E08C0003D08BF00E926C2
:102D42004008C0003F08BF000A30C100C2019E27F0
:102D52003F08C0000F30BF00033014276430C100A9
:102D6200C2013E08C0003D08BF00E9264008C0007D
:102D72003F08BF000A30C100C2019E273F08C000C1
:102D82001930BF00033014270A30C100C2013E08C7
:102D9200C0003D08BF00E9264008C0003F08BF0050
:102DA2000A30C100C2019E273F08C0002830BF0080
:102DB200033014270A30C100C2013E08C0003D089A
:102DC200BF009E273F08C0003230BF000330142FDF
:102DD200C401C5014208410403190F2FC301C30AEC
:102DE2000310C21BF82EC10DC20DF02E0310C40D2C
:102DF200C50D42084002031D002F41083F02031C7B
:102E02000B2F4108BF024208031CC003C00201305D
:102E1200C4040310C20CC10CC30BF72E4508C0003A
:102E22004408BF000800C10001304102031C080031
:102E320006304102031808004B303F020318080015
:102E42000A30400203180800FF30C300C4004108E2
:102E520083134307C90044080318440ACA003F0801
:102E62009427C201CC01CC0A40088313C300C401D9
:102E7200C30EC40EF030C40543080F39C404F03049
:102E8200C305EB30C5000630C60043084507C7003E
:102E920044080318440A4607C8004208470784004A
:102EA20048080318480A0A128A1100220A168A11CF
:102EB200E525C20A08304202031C332F410883135E
:102EC200C900CA013F0894270830C200CC01CC0ACD
:102ED20040088313C300C401C30EC40EF030C405FE
:102EE20043080F39C404F030C305EB30C500063087
:102EF200C60043084507C70044080318440A4607AA
:102F0200C80042084707840048080318480A0A1202
:102F12008A1100220A168A11E525C20A10304202DD
:102F220003180800672FCB00CC0183138038E525F6
:102F3200CC01490807394038E52D420841040319FC
:102F42000800C301C30AC21BAA2F0310C10DC20D80
:102F5200A32F42084002031DB02F41083F02031C69
:102F6200B92F4108BF024208031CC003C00203106C
:102F7200C20CC10CC30BAA2F0800A300A308043083
:102F8200C9000319DD2FCA01463094270A168A1197
:102F9200CC01CC0A1C30E525CC01CC0A3E30E5251B
:102FA200CC01CC0A3630E525CC01CC0A3E30E525F1
:102FB200CC01CC0A1C30E52DCA01463094270A16F2
:102FC2008A11C830BF000730C000E72FF42F3F0836
:102FD200840040080A128A1100220A168A11652505
:102FE200BF0A0319C00A3F08840040080A128A1166
:0E2FF20000220A168A11003803190800E82F81
:02400E00F23F7F
:00000001FF

Thursday, September 17, 2009

mini LCD Projector

simple LCD projector using a small LCD and a bright white LED.



using Nokia 6610/6100 colored LCD + OSRAM high-power LED


demo video:

IR Remote Control

prototype circuit:
single-button (single-function) mini-Remote Control for Sony TV




Hi-Tech C code:
 // Sony Remote Control  
// 12-bit SIRC protocol
// Hi-Tech C code by yus
// rev 1 Oct 28, 2008
#include <pic.h>
__CONFIG(XT & WDTDIS & PWRTEN & BORDIS & UNPROTECT);
#define irled PORTA //IR-LED pin
#define irled_tris TRISA //tri-state
//devices
#define tv 1
#define vcr1 2
#define vcr2 3
#define laser_disc_unit 6
#define surround_sound 12
#define cassette_deck 16
#define cd_player 17
#define equalizer 18
//functions
#define key_1 0
#define key_2 1
#define key_3 2
#define key_4 3
#define key_5 4
#define key_6 5
#define key_7 6
#define key_8 7
#define key_9 8
#define key_0 9
#define channel_up 16
#define channel_down 17
#define volume_up 18
#define volume_down 19
#define mute 20
#define power 21
#define reset 22
#define audio_mode 23
#define contrast_up 24
#define contrast_down 25
#define colour_up 26
#define colour_down 27
//#define channel_lock 28
#define brightness_up 30
#define brightness_down 31
//#define hue_down 32
//#define hue_up 33
//#define sharpness_up 34
//#define sharpness_down 35
//#define recall 36
//#define tv_video 37
#define balance_left 38
#define balance_right 39
//#define equalizer 40
//#define surround 41
#define standby 47
void burst(unsigned int pulses)
{
do //~40kHz, 1/3 duty cycle
{
irled = 0xff;
NOP(); NOP(); NOP();
NOP(); NOP(); NOP(); //@4MHz xtal
irled = 0x00;
NOP(); NOP(); NOP();
NOP(); NOP(); NOP();
}while(--pulses);
}
void space(unsigned int interval)
{
do{
NOP(); NOP(); NOP();
NOP(); NOP(); NOP();
NOP(); NOP(); NOP();
NOP(); NOP();
}while(--interval);
}
void remote_control(unsigned int function, unsigned int device) //~45ms frame
{
unsigned int i, time;
burst(96); //header
space(24);
time = 10; // count the time duration
for(i=0; i<7; i++) //7-bit command/funtion
{ //LSB first
if(function&(1<<i))
{
burst(48); space(24); //logic "1"
time = time + 6; //increment counter
}
else
{
burst(24); space(24); //logic "0"
time = time + 4; //increment counter
}
}
for(i=0; i<5; i++) //5-bit address (device address)
{ //LSB first
if(device&(1<<i))
{
burst(48); space(24); //logic "1"
time = time + 6; //increment counter
}
else
{
burst(24); space(24); //logic "0"
time = time + 4; //increment counter
}
}
space((150-time)*12); // blanking time, complete the 45ms frame
}
//sample main function
void main()
{
irled_tris = 0x00; //as output pin
irled = 0x00; // initial state
while(1)
{
remote_control(power,tv); // power on/off a TV set
//burst(255);
}
}
*tested only with Sony Trinitron (model#: KV-SW212N50)

Wednesday, September 16, 2009

Dancing miniBOT

Dancing mini-MOBOT using Microchip’s PIC16LF73 and two tiny motors (powered by a CR2032 Lithium cell).





Schematic:

Chua's Circuit

Chua's circuit is a simple electronic circuit, developed by Leon O. Chua, that exhibits classic chaos theory behavior.

schematic:

Actual waveforms:





Simulations using Simetrix (SPICE simulator):

POV/BCD Clock

POV(persistence of vision)/BCD(binary coded decimal) Clock


*POV mode:

*BCD mode:



source code for PIC16F microcontroller:
 /////////////////////////////////////////////////////  
// Persistence Of Vision (POV) clock
// Binary Coded Decimal (BCD) clock
// Hi-Tech C code by YUS of ElectronicsLab.Ph
// revision 2.1 Nov 24, 2008
/////////////////////////////////////////////////////

#include <htc.h>
#define _XTAL_FREQ 32768
__CONFIG(XT & WDTDIS & PWRTEN & BORDIS & DUNPROT & WRTEN & UNPROTECT);

#define leds PORTC
#define leds_tris() TRISC = 0x00;
#define adjust RB7
#define adjust_minutes RB6
#define adjust_hours RB5

const unsigned char digits[10][5]={ //10 digits, 5 bytes each
0xc1,0xae,0xb6,0xba,0xc1, // 0
0xff,0xbd,0x80,0xbf,0xff, // 1
0xbd,0x9e,0xae,0xb6,0xb9, // 2
0xde,0xbe,0xba,0xb4,0xce, // 3
0xe7,0xeb,0xed,0x80,0xef, // 4
0xd8,0xba,0xba,0xba,0xc6, // 5
0xc3,0xb5,0xb6,0xb6,0xcf, // 6
0xfe,0x8e,0xf6,0xfa,0xfc, // 7
0xc9,0xb6,0xb6,0xb6,0xc9, // 8
0xf9,0xb6,0xb6,0xd6,0xe1,}; // 9
/*
const unsigned char am_pm[2][11]={
0x81,0xee,0xee,0xee,0x81,0xff,0x80,0xfd,0xf3,0xfd,0x80, // AM
0x80,0xf6,0xf6,0xf6,0xf9,0xff,0x80,0xf6,0xf6,0xf6,0xf9,}; // PM
*/
unsigned char hours, minutes, seconds;
//unsigned char hours_tens, hours_ones, minutes_tens, minutes_ones;

// Interrupt Handler
void interrupt isr()
{
// Timer0 Interrupt - Freq = 0.50 Hz - Period = 2.000000 seconds
if (TMR0IF) // timer 0 interrupt flag
{
TMR0IF = 0; // clear the flag
seconds += 2; //increment time
}
}
void initialize(void)
{
//initial time
hours = 12;
minutes = 34;
seconds = 0;

//Timer0 Registers Prescaler= 64 - TMR0 Preset = 0 - Freq = 0.50 Hz - Period = 2.000000 seconds
T0CS = 0; // bit 5 TMR0 Clock Source Select bit...0 = Internal Clock (CLKO) 1 = Transition on T0CKI pin
T0SE = 0; // bit 4 TMR0 Source Edge Select bit 0 = low/high 1 = high/low
PSA = 0; // bit 3 Prescaler Assignment bit...0 = Prescaler is assigned to the Timer0
PS2 = 1; // bits 2-0 PS2:PS0: Prescaler Rate Select bits
PS1 = 0;
PS0 = 1;
TMR0 = 0; // preset for timer register

// Interrupt Registers
INTCON = 0; // clear the interrpt control register
TMR0IE = 1; // bit5 TMR0 Overflow Interrupt Enable bit...1 = Enables the TMR0 interrupt
TMR0IF = 0; // bit2 clear timer 0 interrupt flag
GIE = 1; // bit7 global interrupt enable

leds_tris();
RBPU = 0; //enable portB internal pullups
}
void leds_on(unsigned char char_byte) //0xff = all LEDs off; 0x00 = all LEDs on
{
leds = char_byte; // use port C for LEDs
NOP();
}
void check_time(void)
{
if (seconds >= 60) { seconds-=60; minutes+=1; }
if (minutes >= 60) { minutes-=60; hours+=1; }
if (hours > 12) { hours -=12; } //12-hour format
//if (hours > 24) { hours -=24; } //24-hour format
}
void pov_display(void) // persistence of vision (POV) mode
{
unsigned char i, digit, hours_tens[5], hours_ones[5], minutes_tens[5], minutes_ones[5];
digit = hours/10;
for(i=0; i<5; i++) hours_tens[i]= digits[digit][i];
digit = hours%10;
for(i=0; i<5; i++) hours_ones[i]= digits[digit][i];
digit = minutes/10;
for(i=0; i<5; i++) minutes_tens[i]= digits[digit][i];
digit = minutes%10;
for(i=0; i<5; i++) minutes_ones[i]= digits[digit][i];
if ((hours/10)!=0) //'wag ng i-display kung wala naman
{
// hours' tens digit
leds_on(hours_tens[0]);
leds_on(hours_tens[1]);
leds_on(hours_tens[2]);
leds_on(hours_tens[3]);
leds_on(hours_tens[4]);
}
// hours' ones digit
leds_on(hours_ones[0]);
leds_on(hours_ones[1]);
leds_on(hours_ones[2]);
leds_on(hours_ones[3]);
leds_on(hours_ones[4]);
leds_on(0xff);
_delay(5);
// colon
leds_on(0xc9);
_delay(5);
leds_on(0xff);
// minutes' tens digit
leds_on(minutes_tens[0]);
leds_on(minutes_tens[1]);
leds_on(minutes_tens[2]);
leds_on(minutes_tens[3]);
leds_on(minutes_tens[4]);
leds_on(0xff);
_delay(2);
// minutes' ones digit
leds_on(minutes_ones[0]);
leds_on(minutes_ones[1]);
leds_on(minutes_ones[2]);
leds_on(minutes_ones[3]);
leds_on(minutes_ones[4]);
leds_on(0xff);
}
void binary_display(void) //binary coded decimal (BCD) mode
{
leds_on(~( ( (hours/10)<<4) + (hours%10) ) ); // BCD hours
__delay_ms(1000);
leds_on(0xff);
__delay_ms(200);
leds_on(~( ( (minutes/10)<<4) + (minutes%10) ) ); //BCD minutes
__delay_ms(1000);
leds_on(0xff);
__delay_ms(500);
}
void adjust_time(void)
{
TMR0IE = 0; //disable timer0interrupt
while( adjust_hours && adjust_minutes ) binary_display();
while(!adjust)
{
// with BCD display
if(!adjust_minutes)
{
minutes+=1;
check_time();
leds_on(~( ( (minutes/10)<<4) + (minutes%10) ) ); //BCD minutes
__delay_ms(500);
}
if(!adjust_hours)
{
hours+=1;
check_time();
leds_on(~( ( (hours/10)<<4) + (hours%10) ) ); // BCD hours
__delay_ms(500);
}
}
TMR0IE = 1; //enable timer0 interrupt
}
void main()
{
initialize();
while(1)
{
check_time();
if(!adjust) adjust_time();
//choose either pov or binary mode
pov_display(); __delay_ms(200);
//binary_display(); __delay_ms(200);
}
}


Tuesday, September 15, 2009

Wireless Oscilloscope



Wireless oscilloscope using Nokia 6120 Classic, National Semiconductor LMX9838 Bluetooth SPP module, and Microchip dsPIC33FJ16GS504.





forum link: Re: Wireless Oscilloscope

Monday, September 14, 2009

Bluetooth Controlled mini-MOBOT





Bluetooth remotely controlled mini mobot (version 2) using Zilog's Z8F082A and National Semiconductor's LMX9838 (Bluetooth® Serial Port Module) with Nokia 6120 classic as remote controller (using Python S60)