Friday, May 19, 2017

8-bit assembler compiler project

This project is an assembler compiler to generate binary executable for 8-bit x86 like CPU systems. This compiler can parse NASM style assembler code and it compatibles with Marco Schweighauser's javascript 8-bit virtual CPU.

Compare with Marco Schweighauser's javascript compiler this compiler parse almost same assembler code and generate almost identical executable code. The only difference in this parser is that all the operands are separated by white space(s), and not with the comma ( , ).

 jmp start
hello:
 db "Hello World!"
 db 0

start:
 mov c hello
 mov d 232
 call print
 hlt

print:
 push a
 push b
 mov b 0
 
loop:
 mov a [c]
 mov [d] a
 inc c
 inc d
 cmp b [c]
 jnz loop

 pop b
 pop a
 ret 

The output generated by this compiler for "Hello World" sample is listed in below and it can execute directly with Marco Schweighauser's 8-bit virtual CPU.

0000    1F0F 4865 6C6C 6F20 576F 726C 6421 0006  
0010    0202 0603 E838 1800 3200 3201 0601 0003  
0020    0002 0503 0012 0212 0315 0102 271F 3601  
0030    3600 3900   

This compiler is implemented using Lazarus / FPC and it is designed to work with different operating systems including Linux and Microsoft Windows.

This 8-bit assembler compiler is an open source, free software project and it is released under the terms of GNU GPL version 3.0 license. All the source codes and Linux based binaries of this project are available to download at https://github.com/dilshan/assembler-compiler.

Thursday, May 11, 2017

Adjustable constant current source

When comes to electronic designing and testing, adjustable current sources facilitates to simulate "load" on circuit(s). The most common use of "constant current source" is to test performance of power supply units and battery packs.

The current source introduced in this article is capable to handle current up to 6A with maximum input voltage of 50V. This is an operational amplifier based adjustable current source and it uses LM358 in a general voltage follower configuration. To handle large currents we use four 0.1Ω 20W resistors as "load resistor", and those load resistors are drive through pair of 55N06 N-channel MOSFET transistors.

Final view of adjustable constant current source prototype.

The power supply unit of this project is build around 9V × 2 (2A) step-down transformer and it is design to get regulated 12V DC voltage. In our design this 12V power source is used to drive LM358 Op-Amp and 12V cooling fan.

In our PCB design we did not include high current paths into PCB track layout. We connect all of of those connections using point-to-point wiring. Large heatsink is recommended for both 0.1Ω load resistors and for 55N06 MOSFET transistors. In our prototype design we use 250mm × 72mm × 50mm heatsink to mount all of those resistors and transistors. To transfer heat we also attach standard 80mm cooling fan into our enclosure.

The schematics, PCB designs and wiring diagrams related to this project is available to download at elect.wikispaces.com.

Sunday, April 16, 2017

Restoration of Philips 852 - 22RH852 turntable / tuner

Philips 852 is tuner, turntable with amplifier which is manufactured by Philips around 1975 - 1977. The tuner stage of this receiver consist with 4 bands such as LW, MW, SW and FM. This unit also comes with dual speed (33⅓, 45 RPM) belt driven turn table. The power amplifier of this unit is delivering 2 × 9W audio output power with pair of 4Ω speakers.

The 852 which we got had problems in power amplifier and turntable mechanism. After tracing the problems in power amplifier, we figure out that both BD262 transistors had short circuits between emitter and collector terminals. Because BD262 is no longer available in the market we replace both NPN and PNP transistor pairs of this amplifier with BD678 and BD679. 

Philips 852 player after cleanup and restoration.

The turntable mechanism of our 852 had many problems due to several missing / damaged parts. Most of the parts are damaged due to corrosion and we fabricate most of them using 3D printer and lathe. The missing antiskate-spring is replaced with modified spring which we got from another broken record player.

After the above fixes Philips 852 start to work again. With large 3 way speaker system this unit produces very good audio quality. The only drawback which we notice with this receiver is it's less sensitive tuner. Compare with most of the receivers SW and FM reception of this receiver is quiet poor, but this can be improve by using good external antennas with this unit.

Friday, March 24, 2017

Enable WebRTC on QtWebEngine for Raspberry Pi 3

WebRTC is a web technology to enable peer to peer communication in real-time. It mainly use to create video conferencing and chat applications using web browsers. In this post we describe how to enable this technology in QtWebEngine on Raspberry Pi 3 platform.

QtWebEngine is embedded browser component which comes with the Qt framework. This component is based on Google Chromium browser and it supports most of the Chromium features including WebRTC. In PC, WebRTC applications run smoothly on QtWebEngine component. But in Raspberry Pi platform situation is different and none of the WebRTC application are work with the QtWebEngine. The only thing which we can see is black box in a HTML5 video tag area. At the time of writing this problem exists in Qt version 5.6, 5.7 and 5.8.