Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
i've looked all over, and it's been done before. there's so many similar projects that have done the same thing, but i don't know which one is the one for me.
i'm doing a project, which uses the keyboard. however, i want to get rid of the keyboard altogether. i want to use the PIC16F84 instead. i don't need all the keys. and the 16F84 must interface to the PS/2 port.
i have a compiler for ASM and BASIC. no C++ though. which project online should i use?

I don't know of any one project to use... there are several out there and all of them have their pros and cons.
However, if I were you, I would put away BASIC and go get a free C++ compiler. They are scattered throughout the net, the one I currently use is Dev-C++ located at
http://www.bloodshed.netIR

================================================================
Ok...if I understand correctly then you want to know how to program the hardware in question through interrupt controls so I will use the mouse as an example of how to make these calls as embedded asm code within Turbo BASIC (since you didn't specify what BASIC compiler you will be using). Although the PIC can be programmatically controlled, there is no real need to take this approach for what you have described so the asm code for programming for mouse control follows:
REM
REM all function calls are made using
REM interrupt 33h
REM
REM let's first intitialize the mouse
asm
mov ax,00h ;move function num. 0 into ax
int 33h ;call interrupt 33h
endREM the mouse show function increments the mouse
REM show counter by one each time it is
REM called. The mouse hide function
REM decrements the mouse show counter by 1
REM each time it is called. The show mouse
REM counter must be greater than 0 in order
REM for the mouse to be visible. The mouse
REM show function must be called after init-
REM ializing the mouse in order for it to be
REM visible. It is therefore advisable that
REM you externally track the value of this
REM counter in a variable in order to know
REM whether or not the mouse is visible or
REM not.
REM
REM let's display the mouse cursor
dim show_count as integer = 0
asm
mov ax,01h ;move function 1 into ax reg.
int 33h ;and call interrupt 33h
end
show_count=show_count + 1REM let's hide the mouse cursor (or at least
REM decrement the show cursor counter
asm
mov ax,02h ;move function 2 into ax reg.
int 33h ;and call interrupt 33h
end
show_count=show_count - 1REM let's get the mouses x,y position
dim x,y as integer
asm
mov ax,03h ;move funtion 3 into ax reg.
int 33h ;and call interrupt 33h
mov x,cx ;the x position is in cx reg.
mov y,dx ;the y position is in dx reg.
endREM call function 03h to get the mouse
REM button status as well
dim buttons as integer
asm
mov ax,03h ;move function 3 into ax reg.
int 33h ;and call interrupt 33h
mov buttons,bx ;the buttons bitmask value
endThere are other functions but this is primarily what you will need. The buttons variable value is as follows:
buttons=1 then left mouse button pressed
buttons=2 then right mouse button pressed
buttons=4 then center mouse button pressed
buttons=6 then center/right mouse buttons pressed
buttons=5 then center/left mouse buttons pressed
buttons=7 then center/left/right mouse buttons pressed
buttons=3 then right/left mouse buttons pressedI hope this isn't too confusing. It shows how to program for the mouse. If you need info on DOS programming for the keyboard or some other interrupt information just post back and I'll do my best to help.
borelli35

well, i need coding soley for the keyboard. of course, that's been done before. the only thing is that not all of the projects come complete with a schematic.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |