MAMEWorld >> Programming
View all threads Index   Threaded Mode Threaded  

Pages: 1

lxd
MAME Fan
Reged: 02/27/14
Posts: 25
Send PM


How to send serial for once 2 bytes to CPU i8051?
#324794 - 04/16/14 07:39 PM


It would lost the first byte.

What shall I do?

m_maincpu->i8051_set_serial_rx_callback(read8_delegate(FUNC(bigmario_state::data_to_i8031),this));

READ8_MEMBER(bigmario_state::data_to_i8031)
{
return m_serial_data_in;
}

THE OTHER PLACE:
m_serial_data_in = 0x01;
m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); //MCS51_RX_LINE P3.0: Serial Port Receive Line
m_maincpu->set_input_line(MCS51_RX_LINE, CLEAR_LINE);
m_serial_data_in = 0x02;
m_maincpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE); //MCS51_RX_LINE P3.0: Serial Port Receive Line
m_maincpu->set_input_line(MCS51_RX_LINE, CLEAR_LINE);



lxd
MAME Fan
Reged: 02/27/14
Posts: 25
Send PM


Re: How to send serial for once 2 bytes to CPU i8051? new [Re: lxd]
#324851 - 04/17/14 05:45 PM


I have done it.
Sorry for my English level. It's complex, so I have to use Chinese.

依据8031的CPU手册,发送串口数据给CPU的时候,CPU需要一位一位的收取,如果上一位还没收取完成,就送下一位,肯定会覆盖掉前一位的数据。另外,如果CPU处于中断状态,串口中断优先级最低,也会造成数据丢失。

解决办法是:
1,在8031的ROM里将串口中断优先级提高,不要轻易 CLR EA
2,在游戏驱动里,将连续发送的的字符先存入队列,例如
#include <queue>
std::queue<int> m_fifo; //串口缓冲
然后等上一个数据发送完成,并且CPU回调的时候,再发送下一个数据。



Roberto Fresca
Cuernito Rules!...
Reged: 08/12/04
Posts: 285
Send PM


Re: How to send serial for once 2 bytes to CPU i8051? new [Re: lxd]
#324934 - 04/19/14 03:45 AM


Please... Write plain english.
Doesn't matter how bad could be. Always will be better than chinese for us.

And BTW.... Why are you not sending us all these fixes you're claiming to made, among your 'bigmario' driver?



-- Risen from my grave --



StilettoAdministrator
They're always after me Lucky ROMS!
Reged: 03/07/04
Posts: 6472
Send PM


Re: How to send serial for once 2 bytes to CPU i8051? new [Re: Roberto Fresca]
#324936 - 04/19/14 04:59 AM


> Please... Write plain english.
> Doesn't matter how bad could be. Always will be better than chinese for us.
>
> And BTW.... Why are you not sending us all these fixes you're claiming to made, among
> your 'bigmario' driver?

"Big Mario"?
http://www.alibaba.com/product-detail/Big-Mario-game-board-PCB-game_1752267209.html

I think one of his previous posts had a picture, looked like this...

- Stiletto



lxd
MAME Fan
Reged: 02/27/14
Posts: 25
Send PM


Re: How to send serial for once 2 bytes to CPU i8051? new [Re: Roberto Fresca]
#324984 - 04/20/14 06:57 AM Attachment: 36b.png 840 KB (0 downloads)


Sorry for I have not finished it.

It's the picture of the game.

[ATTACHED IMAGE]

Attachment



lxd
MAME Fan
Reged: 02/27/14
Posts: 25
Send PM


Re: How to send serial for once 2 bytes to CPU i8051? new [Re: lxd]
#324985 - 04/20/14 06:58 AM Attachment: icb.jpg 39 KB (0 downloads)


The IC board

[ATTACHED IMAGE]

Attachment


Pages: 1

MAMEWorld >> Programming
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Pi 
0 registered and 106 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 4310