MSX REMOTE CONTROL

페이지 3/3
1 | 2 |

By RetroTechie

Paragon (1563)

RetroTechie의 아바타

04-11-2015, 16:19

enribar wrote:

Great and creative idea! But very difficult (for me) to realize.
I though it was more simple, for example, as first step connect the msx to the keyboard of a universal dvd RC.
Prices of new URC are quite low in internet.
Another idea: a cartridge with IR and FPGA reprogrammable with new codes, with the aim to handle more and more dvd models.
This also is theory, I cannot realize it and where to start, maybe asking in some electronic fan forums?

NYYRIKKI wrote:

I did not calculate anything, but I think that getting out something like 38KHz is possible with OTIR or OUTI, but my head hurts even when I'm thinking about modulating that. (..)
@RetroTechie I think you forgot the oscillator (..)

Aargh.. like said you guys are over-thinking this. Eek! "Modulating an 38 KHz carrier frequency" in this case reads as "produce some pulse trains with individual pulses spaced 1/38000 second apart". @ 3.58 MHz, 1/38000 sec = ~94 clock cycles, that's more than enough for a Z80 to flip a bit on an I/O port back & forth. Even enough to play a bit with duty cycle. Between those pulse trains you have much longer delays so Z80 just sits & waits there for a few milliseconds.

Required transmit hardware is something like the circuit found in link below:
Web-based IR remote on the Raspberry Pi (3rd image from the top)

For 3.3V read 5V, for GPIO 22 read: output pin from MSX joystick or printer port (joystick port is easier as it includes 5V supply). Circuit I built back in the day included a capacitor to allow higher peak current through IR led (for greater range), and probably a more beefier transistor. Forget the RPi here, our humble MSX does it too... :-)

As for the software part, I dug up some code used back then. Below is the 'driver' for sending codes using RC-5 protocol (36 KHz carrier frequency). 5-bit 'address' (0-31) addresses a particular device (TV, DVD player, VCR, CD player, etc, etc), command code roughly corresponds with different keys on your remote. Some commands may be the same between devices, most will have different/specific meaning for each device. Device code used here is 0, which you can safely assume to mean "TV".

; routine for sending IR command (Philips RC-5 code)
; input: C=port address to use
;	 H=output value for IR-led on
;	 L=output value for IR-led off
;	 DE=command code (normally 0-63, possibly other values)
; output: routine should end with sending "off" value to I/O port C
; may change all registers
; interrupts are disabled on entry, must be left disabled
; P.S. relies on Z80 running @ 3.58 MHz for correct timing

sendcmd:di		; just in case
appcod: ld d,%11100000	; 3 startbits + device code (0-31)
	rl e
	rl e		; put bit 5 of command code ready in E7
	rl d
	call sendbit	; send 1st startbit (1)
	rl d
	call sendbit	; send 2nd startbit (1)
	rl d
	call sendbit	; send control-bit (always 1 as well)
	rl d
	call sendbit	; send bit 4 of address
	rl d
	call sendbit	; send bit 3 of address
	rl d
	call sendbit	; send bit 2 of address
	rl d
	call sendbit	; send bit 1 of address
	rl d
	call sendbit	; send bit 0 of address
	rl e
	call sendbit	; send bit 5 of command code
	rl e
	call sendbit	; send bit 4 of command code
	rl e
	call sendbit	; send bit 3 of command code
	rl e
	call sendbit	; send bit 2 of command code
	rl e
	call sendbit	; send bit 1 of command code
	rl e
	call sendbit	; send bit 0 of command code
	ret


; Sending of one bit (in carry):
;  0: half bit-time a pulse train, half bit-time pause
;  1: half bit-time pause, half bit-time a pulse train

sendbit:
	jr c,send1

; Sending a 0 bit:

	call halfon	; send pulse train
	ld b,220
wait0:	djnz wait0
	ret		; call sendbit with NC takes exactly 6352 clock cycles (1.77 msec)

; Sending a 1 bit:

send1:	ld b,220
wait1:	djnz wait1
	call halfon
	ret		; call sendbit with C takes exactly 6357 clock cycles (1.78 msec)


; Send pulse train for half bit-time (889 usec) on:

halfon: ld b,32
pulslus:out (c),h
	jp pulsoff
pulsoff:out (c),l
	ds 7,0
	inc hl
	dec hl		; -> exactly 100 cycles (27.9 usec.) per pass
	djnz pulslus
	ret		; call halfon takes exactly 3232 cycles (903 usec)

As you can see there's really not much to it. A glorious grand total of 117 bytes Z80 code... This is code + hardware that was used, read: known working. Stuff coded around it is just 'fluff' to make things more user friendly.
Code for other protocols/brands/models is mostly similar. Note that some systems don't use a carrier frequency, just single pulses where info is conveyed via the "off" time between pulses. This reduces power consumed by the IR diode, read: (in theory) longer battery life for the remote, but makes it more difficult to tell apart signal & noise on the receiving end.

Receiving takes more complicated code, but in this case that built-in filter in IR receiver IC filters out the carrier frequency. So IR remote sends a series of pulse trains, signal the Z80 sees is just a few on/off transitions in millisecond range (see datasheet from link in my previous comment).

NYYRIKKI wrote:

(..) but maybe easier is to use 555 or similar...

Yes, slightly easier to program. But would fix the carrier frequency in hardware, and make it impossible to transmit for TV's etc that only use single pulses. Probably NOT what you want... Doing this in software is almost as simple, keeps the hardware to minimum, and much more flexible. Our MSX'es Z80 is a pretty nice square wave frequency generator...

I don't understand why people keep insisting on bringing in an extra ucontroller (+ PC + development suite on there + programming cable) and devising some 'upload protocol' when our MSX can do the job fine by itself. Many of us know how to write Z80 code, right?

NYYRIKKI wrote:

On most of the cases it is not very important if the carrier is +- few kHz off. It mostly affects the distance the led needs to be from receiver.

Software method brings you within ~1% or better of desired freqency, that's more than good enough. A little off is fine, just reduces sensitivity at the receiving end (again: see nice graphs in IR receiver IC datasheet).

enribar wrote:

There are also Apps that allow to control TVs with smartphones,

For phones that include an IR led: yes, easier than buy a few parts, bring out MSX and solder iron. But for those that can solder a few parts together, not as much fun / interesting.

By NYYRIKKI

Enlighted (5595)

NYYRIKKI의 아바타

04-11-2015, 19:35

RetroTechie wrote:

Aargh.. like said you guys are over-thinking this. Eek! "Modulating an 38 KHz carrier frequency" in this case reads as "produce some pulse trains with individual pulses spaced 1/38000 second apart". @ 3.58 MHz, 1/38000 sec = ~94 clock cycles

Oh, where did I forgot the last zero? Damn, I must have been really messed up. I thought it would be more close to 10 clocks than 100. Well, sometimes I just really should use brains to do the actual thinking... Damn, how stupid... anyway I kind of like my SCC idea still Smile

Quote:

Required transmit hardware is something like the circuit found in link below:

Yes... And if you don't have to transmit across the room then you can probably even leave out the transistor stuff... I know for sure that printer port is beefy enough to light up a led as before all these emulators and stuff I used to have 8 leds connected to printer port to write out debug codes to see where my program crashes. Tongue I'm pretty sure that same applies to joystick port buttons as well.

enribar wrote:

There are also Apps that allow to control TVs with smartphones,

Actually there is pretty interesting stuff also behind this story... At least 15 years ago in phones the IR led was usually connected directly to UART. For long it was general understanding that you can't use it to control TV's and stuff, but then someone figured out that if you put the carrier off by a mile (ie. like transmit 70KHz) the receiver can't see it and so he came up with a plan to use correct amount of startbits, stopbits & databits to generate both correct carrier and incorrect carrier by feeding up serial data to UART and keeping the ouput buffer full... Compared to my plan that is pretty sick stuff, but that is how first phones outputted remote signals to TVs Smile

By usuario_msx2

Paladin (747)

usuario_msx2의 아바타

04-11-2015, 22:05

In the other hand,
you can use 2 xbee radio modules(no arduino needed) one from msx,(you need a port for do it if you wish or other option) sending play/stop/fwd,etc.. command in your software to the other dvd xbee.

The other xbee must be installed in the dvd player, receive command, and set play/stop/etc.
See it:
(in the msx side: replace the neccesary push button input controls needed by your msx control signals (in your software) for play/pause/etc)
http://examples.digi.com/sensors/802-15-4-digital-input-with...

in the dvd side: you must wire the button controls(front dvd) to the xbee output signals.
http://examples.digi.com/lights-motors-more/802-15-4-digital...

More signals example(joystick)
http://examples.digi.com/sensors/joystick-with-xbee/5/

The difficult way: adapt de dvd player for the xbee.
The good thing: no infrared problems anymore.

It must be enough.

By usuario_msx2

Paladin (747)

usuario_msx2의 아바타

25-02-2016, 20:23

Update: wireless arm robot

By enribar

Paragon (1073)

enribar의 아바타

25-02-2016, 21:11

It's very strange that in the 80s, the Era of colur TVs and video recorders, any MSX manifacturer didn't think about a remote controller peripheral... Maybe the use of it, was considered weird Smile

By mars2000you

Enlighted (5693)

mars2000you의 아바타

25-02-2016, 22:01

enribar wrote:

It's very strange that in the 80s, the Era of colur TVs and video recorders, any MSX manifacturer didn't think about a remote controller peripheral... Maybe the use of it, was considered weird Smile

Except the NTT Captain Multi-Station !

By usuario_msx2

Paladin (747)

usuario_msx2의 아바타

25-02-2016, 22:49

SVI-ROBOT ARM

OWI-535 Robotic Arm Edge

XBEE+ARDUINO+MOTOR CONTROL DRIVERS:
https://www.flickr.com/photos/44218601@N06/sets/721576580703...

By Guillian

Prophet (3354)

Guillian의 아바타

26-02-2016, 00:00

(^___^) Nice project!

By enribar

Paragon (1073)

enribar의 아바타

08-03-2017, 22:21

페이지 3/3
1 | 2 |