Skip to main content

My first Micro-controller program and this is how it was started.

I always have interest in electronics and i think in 1994 i got an physics book from some where that i don't remember now. Everyday after school i read it and got more interested on it even though i don't understand what its all about. Day by day small radios are disassembled and experimented how it works and able to fix the issues.
When i was in grade eight till ten i don't have any interest in studying any subject that i feel useless. More and more focus to physics and math but 99% is always physics specially the electronics chapters.

Couple of friends from school know that i know electronics some how and we share what we built and ideas. Those days Internet or PC is not available for me but a friend have i PC and i used to visit him and he knows some computer skills. we spent time on dial-up Internet in IRC. :)

One day my physics teacher asked me do you like electronics? i said yes i do and i want to learn more. So he told if you love electronics i can help you to meet his VTC student, a great guy and now a good friend of mine too. He is like a electronics father to me so i told my other friend that i met a guy who is really good in electronics and let me introduce you to him too. So we meet him after school at electronics guy's office. So we all meet and he took us to his work shop and gave some books to learn, most of the things was in the physics textbook but i took it. After a week i learn general components, color codes and more. My friend got into more computer programming and me into electronics.

I always remember what my electronics teacher said. "Don't jump into digital electronics without knowing basics and analog electronics" so everyday i learn Transistors and transistors are the beginning of IC's. All most all semiconductors covered. Everyday circuits and a breadboard given to me to do my practice. Finally i manage to transfer to analog electronics , playing with sound waves , light waves , infrared etc. Able to use first timer (555 timer IC) ever built and still its used in most electronics applications. Op-amps like 741 by fair child was an legendary IC i have used. After an year learn digital electronics, logic gates which makes things difficult when combining two different types of electronics.

Luckily i was able to join MITE to learn more theory and graduated being the first in electronics batch. Sometimes now also invited me to come there to help new guys but due to my busy schedule of experimenting stuff i was not able to go there.

Later my friends and me spent more time on experimenting and found a cheaper micro controller by Microchip which built as a kit by Mikroelektronica a Belgrade company so we order some chips and since the programmers are bit expensive we built a programmer by our self and started playing with it. Before that we make programs from Qbasic and control the PC parallel port and that was fun.

If i want to learn microelectronics i need to learn to right some code. So i started with Assembly language which was tough to newbie on programming. After couple of months on 2002 i wrote my first fully functioning ASM code for a customer (Dhiraagu) to control a ventilation fan of some storage area. Here it is and this was my first ever micro-controller program that i wrote. :)

list p=16f84a
__config _wdt_off & _xt_osc

cblock 0x0c
org 0x00
call mainsetup
call setport
call jumpertest
goto main
org 0x04
goto isr
bsf status,rp0
movlw b'00011111'
movwf trisa
movlw b'00000001'
movwf trisb
bcf status,rp0
movfw porta
movwf jumper1
movwf jumper2
clrf delaystart
bsf intcon,7 ;global interrupt enable
bsf intcon,4 ;rb0 intrrupt enable
bcf intcon,1
; isr code
bcf INTCON,GIE        ; Disable all interrupts
; btfsc INTCON,GIE ; goto ISR
bsf delaystart,0
movfw jumper1
movwf jumper2
bcf INTCON,INTF ; Clear interrupt fleg RB0/INT
RETFIE ; Enable all interrupts
; 1sec delay
call DLY20
decfsz fourmsec,0
goto secdelay
maindelay call outhigh movlw 4
movwf fourmsec
skpz jumper2 decf jumper2
skpz jumper2 call secdelay
goto maindelay
clrf delaystart
movlw 0x02
movwf portb
movlw 0x00
movwf portb
goto main

DLY20       MOVLW d'250'
            DECFSZ CNTMSEC,f
            GOTO MSECLOOP

            BTFSS STATUS,Z
            GOTO MICRO4

btfsc delaystart,0
call maindelay
goto outlow

Post a Comment

Popular posts from this blog

SIMCOM SIM900A fixed

Since everyone is interested in this post and lots of request comes to get the firmware, i have put a link so that everyone can download it easily. SIMCOM 900A firmware

Its been a while that i was trying to fix the SIM900A GSM module. This module support local GSM band but after some researches it was concluded that it is carrier locked :(. After long conversion of days to actual chip manufacture SIMCOM, they told it can be fixed by updating its firmware to latest original version but unfortunately they don't provide firmware to small parties.

I never stop trying to get the firmware and SIMCOM again replied, this time they said contact local SIMCOM supplier and request for firmware. But this little Maldives don't have SIMCOM or any electronics manufacturer. So i contacted my friend coody from NOA LABS/Smart prototyping (a friend in china) and told him to help me. I explained him what to do so he can communicate with SIMCOM in china.

Finally he sends and email saying that he g…

Clover Display M302 hack

Its been a while i have this LCD and today i thought of connecting the LCD display to Arduino. Unfortunately i could not found any pin outs of this from any where and from the manufacture. Actually this is very old model which i got from old FAX machine and this display is a very cheap from online sources.
Clover Display M302 PCB Ver 1.0 (16x2) which has 10 pin flat cable. After researching for a while from the internet i have seen in many forums people are asking for help on how to connect it and what is the pin configurations? so i thought of helping them as well as my self at the same time.
After going through some of my old collections of Russian data of displays and things i found a basic diagram of how 10 pin LCD display configuration. 
PIN1   - VSS PIN2   - VDD PIN3   - CONTRAST PIN4   - RS PIN5   - R/W PIN6   - ENABLE PIN7   - DB4 PIN8   - DB5 PIN9   - DB6 PIN10 - DB7
I tried these configurations and wired up to the arduino with the LCD sketch and it worked on the first try. …

TCP communication from NEOWAY M590E- Successful

Some of the GSM/GPRS chips do not support HTTP services and since the modems are controlled via AT commands, the AT command sets are very limited to HTTP commands in NEOWAY M590E.

The only option to communicate with any cloud based or locally hosted server was using TCP protocol. I have used HTTP services in many of my projects and experiments, it is easy and with few lines of code can manage an HTTP requests. For weeks i have been struggling with TCP request and every time it fails to connect or sometimes data is sent but from server side there is no new data fetched.

Basically TCP is transport layer in OSI model and HTTP is in application layer. TCP will do a socket based connection to servers predefined port. For example what i mean is it needs a listener to listen to port that you define or open to use.

After weeks of reading articles and AT command sets thoroughly, finally i managed to handle a TCP request from modem. But still it fails sometimes or unable to conn…