30th Mar 2023, 2:17 pm | #41 |
Triode
Join Date: Dec 2021
Location: Michigan, USA
Posts: 40
|
Re: Anyone building a PICL? more PCBs available
The problem exists on my boards, too, so once I find the problem it should be easy to fix the issue in the program for the 'standard' boards. Patience, please.
|
31st Mar 2023, 1:43 am | #42 | |
Octode
Join Date: May 2018
Location: Northampton, Northamptonshire, UK.
Posts: 1,444
|
Re: Anyone building a PICL? more PCBs available
Quote:
- However, I've just tried holding down SenseA, and resetting, and this does work! (displaying the light-show). Plus holding down SenseB, and resetting, gives Load HEX, Save to Flash choices. So it seems the buttons are getting read OK at reset, at least (and maybe something else after that is conflicting with Status reading) I had initially thought Warm Start might had been like an 'Old' command, that allowed you to get straight back to last running program (I haven't found how you can escape from one, without a reset - and then possibly losing unsaved prog, even when held in NV/F-RAM) But Chris had also found that the original 16F877 PICL/NIBL seemed to over-write the first 2 bytes of the program (line no.), and could recover it, if re-entering those bytes. - So maybe it would be possible to have a third 'Hot Start' option to do this, as glancing through 16F18877 source, it seems a change was previously-made to only erase a smaller area, after Cold Start. I'd tried it at work, with Chris telling me what to type in NIBL to read / write Status Flags (when we first discovered buttons weren't being read!). And we just used this, for simplicity - Where I only got '191' (10111111 binary pattern) all the time: 10 PRINT STAT 20 GOTO 10 Chris thought the buttons were actually working with the PIC16F18877 I gave him, when he first tried them. But when I asked what STAT values he got, he said he now too only got STAT=191 on this. However, with the 877A, he got 176 (10110000 binary pattern) with switches open, 160 (10100000) for A-only activated and 144 (10010000) for B-only activated. So I wonder if this info with FLAG bits F0..F3 always reading low, rather than high, (along with SA & SB actually working at reset) might be of assistance in finding the issue with this 16F18877 version's code? Last edited by ortek_service; 31st Mar 2023 at 1:51 am. |
|
31st Mar 2023, 2:56 am | #43 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
The buttons work at reset because thats PIC code Owen, all that stuff happens before entering the emulation. Once NIBL or the monitor is running, thats SC/MP code, its the scamp CSA instruction thats not emulating properly - or rather the port read during the CSA.
The button test program (a few posts up) works fine on the 877 or 877A. If I know Mike, he won't sleep until its fixed! Cheers Phil |
1st Apr 2023, 2:14 am | #44 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
|
1st Apr 2023, 10:51 am | #45 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
Whoops sorry the link to the SC/MP source code was broken, its fixed
Its on the PICL page of http://philg.uk under the header "Some useful files, docs & links:". |
1st Apr 2023, 12:29 pm | #46 |
Hexode
Join Date: Jan 2021
Location: Ashford, Kent, UK
Posts: 320
|
Re: Anyone building a PICL? more PCBs available
Hi Phil, enjoyed the Life video I'm just looking at the assembler listing for Life and I'm a bit confused:
Code:
NXTBYT: LD @1(P1) JZ DOT LDI '#' JMP HASH DOT: LDI $2E ; MAKE IT PRINTABLE HASH: .DB 0X20 ; PUTC LDI 0 ST @1(P2) ; CLEAR GEN2 ARRAY DLD 0(3) JNZ NXTBYT |
1st Apr 2023, 2:46 pm | #47 | |
Octode
Join Date: May 2018
Location: Northampton, Northamptonshire, UK.
Posts: 1,444
|
Re: Anyone building a PICL? more PCBs available
Quote:
Plus that would presumably also affect Kitbug+ - I've just tried this for the first time, and found when using 'R' to display SC/MP registers, then ST always shows 'FF'. Whereas it was I presume holding down the buttons before doing that should affect bits in the Status register (especially as I see it was always 30h in screenshots in the PICLV2 PDF manual. Once a new PIC16F18877 version with the bug-fixed is available, then I presume the mini Arduino module + sketch program Mike had attached to a (now removed?) zip file on previous possible fix post is only required for those who haven't got a programmer that supports the PIC16F18877 ? I know you'd said programming these was a bit awkward, but when I'd readout one you'd done for me on a Dataman-Pro, it seemed all the Config options were at defaults and EEPROM was also all blank. Although the save IntelHex file from it, seem to have several regions, when I viewed it in HxD. So I presume it should just be a case of re-programming the FLASH and could do this with MPLAB and a PICkit, using a suitable DIL40 breakout board (Like a PIC16F877 Demo one I have) ? - Unless you've got access to a Universal programmer (It seems a TL866 also supports it). |
|
1st Apr 2023, 3:02 pm | #48 | ||
Octode
Join Date: May 2018
Location: Northampton, Northamptonshire, UK.
Posts: 1,444
|
Re: Anyone building a PICL? more PCBs available
Quote:
Quote:
It was the first time I'd tried uploading a program to this, and installed latest TeraTerm 4.106, as I didn't know about setting character / Line delays in other Terminal programs, trying 1ms & 100ms as I wondered if the 9600 version didn't need as long delays as 1200 baud's suggested 3ms & 300ms, that I'd tried but didn't realise how long you needed to wait before hex-load 'done' appeared. - But I then later read you didn't need these delays for hex loader, only sending to NIBL, so it seems I'd got a bit confused over this when I didn't know what to expect when hex-loader completed. I also eventually worked-out, looking at source code, that after PICL reset, I needed to go into Kitbug+ and type G1800, to run it as it had been uploaded to that RAM address. - But I presume it's also possible to do a Cold / Warm restart into NIBL (if that only erases first 2-bytes / copies a 1-line program to start of Page 2?) and issue a call to the start address from that? Last edited by ortek_service; 1st Apr 2023 at 3:09 pm. |
||
1st Apr 2023, 6:52 pm | #49 | |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
Quote:
When implementing NIBL on the PICL Karen made a few small changes, the standard I/O routines GECO and PUTC are actually run in PIC code rather than emulated SC/MP code, so Karen gave each an opcode to make the calls easy. I also use these in KB+ 0x20 = putc 0x21 = geco (but actually doesnt echo) 0x22 = check for a character (I think its called 'break' in NS speak. cant remember without looking it up) Code:
For putc, 0x20 replaces: C4 C4 LDI 0C4H ; PUTC is at 01C5 33 XPAL (3) C4 01 LDI 01 37 XPAH (3) 3F XPPC (3) ...and for GECO, 0x21 replaces: C4 85 LDI 85H ; GECO is at 0186 33 XPAL (3) C4 01 LDI 01 37 XPAH (3) 3F XPPC (3) to test the result of a program etc you'd terminate your sc/mp program (or set a breakpoint) with XPPX P3 (0x3F) and the R would show the register contenst returned by that program. In other words R shows a RAM copy if the registers, you can set the register contents manually before running a program (same idea as for the MK14) by editing the register image in memory, these are picked up on a 'G' command. Re programming, just for the challenge I forced myself through the mplab process and it was painful, unloading the current one, finding & loading an obsolete version etc, I wouldnt avoidably do it again, its so much easier to use Mikes Arduino method! Uses any old Nano which can be re-purposed later. But yes, its all in flash, you can see NIBL, KitbugPlus and the Lightshow if you do a hexdump of the PIC flash. Cheers Phil PS thats right, the character delays aren't necessary for the hexloader, only for NIBL, life.hex loads quite quickly without them PPS the life.asm code is quite verbose as I've not tried optimizing anything other than clearing gen2 simultaneously with printing gen1. I'm sure it could be much improved! For one thing you could remove the .DS 576 from gen2: its only there to reserve memory. That would almost halve the hexfile size! Last edited by Phil__G; 1st Apr 2023 at 7:04 pm. |
|
2nd Apr 2023, 12:33 am | #50 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
Heres a demo of the register command Owen.
Did you download the PICLv2 manual ok, it details KitbugPlus Cheers Phil |
2nd Apr 2023, 10:57 am | #51 |
Octode
Join Date: May 2018
Location: Northampton, Northamptonshire, UK.
Posts: 1,444
|
Re: Anyone building a PICL? more PCBs available
Thanks for the info, Phil.
I did have an older version 5.x of MPLAB-X installed, that I'd read was below the number that was said not to work anymore with this - Although I thought that was just an issue for the assembler, and it would still be possible to load a .hex file and use MPLAB just for programming. However, as I have access to a Dataman-Pro with a ZIF DIL48 socket, that seems to read one OK at least (And Chris's TL866-II may also support the F18877, as well as the 877A he used it for). So I'll probably just try, to save having to do any wiring-up etc. Yes, the PICv2 manual was the first one I'd downloaded in order to assemble the board. And then discovered the Kitbug+ info in there, whilst looking for instructions for that, as would have been rather lost without the info in there. I'll give that Registers demo a try, a bit later, to see if it gives different ST values - Although I would expect ST probably should have been 30h, rather than FF, as shown on your F877 + KitBug+ loaded examples in that pdf. |
2nd Apr 2023, 11:20 am | #52 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
The key thing is that the memory area just below $2C00 displayed by the 'R' command isnt populated from the real hardware registers until your code executes a breakpoint 3F. Then, the R command is used to display that bit of memory. Before running a program with 'G' (goto) you can pre-set the hardware registers by editing values into this memory, but when KitbugPlus is first loaded, the values below $2C00 which 'G' copies to the hardware registers are arbitrary. It works very much like SCIOS in the MK14
I know my docs aren't the best, often rushed and key points may be skipped, a more accurate description for the KB+ document would be "that 'R' doesnt actually display the hardware registers in real time, it displays part of memory reserved for storing the register contents following a breakpoint, and prior to a breakpoint, unless manually edited, this area of memory isnt initialised. Any manually edited or arbitrary values at these addresses are copied to the hardware registers on a 'G' command." SR is at $2BFF EX is at $2BFE AC is at $2BFD PT2 is at $2BFB & 2BFC PT1 is at $2BF9 & 2BFA PC is at $2BF7 & 2BF8 (P3 holds the PC address you just came from with the XPPC P3) Cheers Phil Last edited by Phil__G; 2nd Apr 2023 at 11:41 am. |
2nd Apr 2023, 8:49 pm | #53 |
Octode
Join Date: May 2018
Location: Northampton, Northamptonshire, UK.
Posts: 1,444
|
Re: Anyone building a PICL? more PCBs available
Thanks for extra info about this.
I've just loaded your 'Registers.hex' demo. And ran it in KitBug+, using 'G2200', finding that it sets Status to xAh (xxxx1010) - So F3=High, F2=Low, F1=High, F0=Low (With F3 & F1 LED's lit to show this). Pressing 'R' after this, then shows 'ST' is now '3A'. More surprisingly, I also discovered that if I hold down SA / SB switches, before issuing a 'G2200' then type 'R', I get: SB SA ST H H 3A (Neither Switch Pushed, so SA & SB still High via pull-ups) H L 2A L H 1A L L 0A (Both Switches pushes, grounding SA & SB) So the switches (/ SenseA & SenseB) are getting read OK on F18877 version, by KitBug+ - Which I thought was also written in SC/MP assembler. And so is using the same PIC Emulation code as for NIBL? (In which case, has NIBL itself been changed / NIBL uses different SC/MP instructions, that aren't quite working properly - So could also prevent other SC/MP programs from running correctly, that used these, and not just problems reading the Status reg.) Last edited by ortek_service; 2nd Apr 2023 at 8:55 pm. |
2nd Apr 2023, 9:22 pm | #54 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
Ah I'm with you now Owen!!! sorry a bit slow on the uptake here...
Yes it does seem the sense inputs are being merged into the status as you'd expect Hmmm... more to this than first apparent.... |
2nd Apr 2023, 9:39 pm | #55 |
Octode
Join Date: May 2018
Location: Northampton, Northamptonshire, UK.
Posts: 1,444
|
Re: Anyone building a PICL? more PCBs available
One thing that did surprise me, was if I reset it, and again selected [K]itbug+, plus typed 'G2200', I then got it going into continuous-loop LED lightshow.
- So I presume that routine must be getting re-copied from PIC-FLASH, into the (F)RAM, at the same 2200h address (even without holding down Sense A switch at reset). But when it automatically-resets (displaying the same C / W / K choices menu), after a Hex-upload completes, the just-Uploaded Hex is still there. So I guess after a Hex-Upload, it jumps to a point after the PIC does initial set-up memory-copying. |
2nd Apr 2023, 10:58 pm | #56 | |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
Sorry for the rambling repetitive misunderstanding Owen, I'd gone off on a complete tangent there
What you describe above is how Mikes version works, on Reset or power up, anything not [S]aved will be overwritten by the last saved Page1 and Page2: Quote:
Since memory is re-loaded from flash on Reset, the trick is load your hex file, then save it to flash by holding Sense-B, dab reset, and selecting [S]. Mike, would it be feasible to change this, so Reset leaves memory alone, and only on [W]arm does Page1 and Page2 get loaded? Cheers Phil Last edited by Phil__G; 2nd Apr 2023 at 11:10 pm. |
|
3rd Apr 2023, 12:11 am | #57 |
Octode
Join Date: May 2018
Location: Northampton, Northamptonshire, UK.
Posts: 1,444
|
Re: Anyone building a PICL? more PCBs available
Thanks for the good explanation, which all makes sense.
Yes, this was all with Mike's version, that you'd prog'd into the F18877's for me. (And I was going to have a look at the source files, but it seems I hadn't saved a couple of the initial one-byte patched one he'd posted, on this computer.) But I wasn't sure how much was common with your PICL V2 F877 version (I've ordered a couple of cheap F877A's from a UK 'Bay seller, to play with as well / possibly use on a PIC14 or other project that still needs that particular one, without re-assembling code) I had previously suggested that a 'Hot' restart option, that doesn't wipe / over-write parts of the RAM may be useful - Particularly also for NIBL BASIC Progs you haven't saved, although it seems only a couple of bytes (the first line no.) of NIBL Progs (in Page 1) get over-written (By Cold Start, as Warm start does copy a one-line program, so over-writes more?), so can at least do an 'OLD' via re-writing those 2 bytes (as detailed in your instructions, so I guess your PICL V2 PIC16F877 version did similar / NIBL does this at reset?). |
3rd Apr 2023, 1:21 am | #58 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
Mike will confirm but I think his NIBL code is unchanged other than the PAGE2-IS-ROM test, we did a lot of too-&-fro emailing at the time testing various updates but I dont recall any NIBL changes. In practise my own are mostly used for m/c anyway, NIBL is great as a novelty but I've found the PICLv2 a great platform for playing with scamp code.
Yes the 877 version just overwrites the first 3 bytes of each page on reset, whereas Mikes loads both pages from whatever is stored in flash. I'm hoping we will have a new member here tomorrow, I've just been chatting with a genuine SC/MP enthusiast who wasnt aware of this forum, he's built quite an elaborate SC/MP system and has lots to show & tell Cheers Phil |
3rd Apr 2023, 6:03 pm | #59 |
Pentode
Join Date: Nov 2022
Location: Chesham, Buckinghamshire, UK.
Posts: 135
|
Re: Anyone building a PICL? more PCBs available
Looking for a bit of advice, I have been having problems reliability 'transfering' NIBL programs to my PICL. The initial problems were certainly down the terminal problem but even with TeraTerm I have a problem. I am sure this has nothing to do with the PICL or NIBL but would be grateful for any suggestions. It looks like the file is initially sent correctly but then further additional data is sent which often corrupts NIBL. I have looked at the file with a hex viewer and all looks fine with no extra garbage at the end. Lines are terminated with CR and LF - Any thoughts ?
TeraTerm is set to 3mS / 300ms - extending these further does not help - and I am using the 'transfer' command which is I assume correct ? |
3rd Apr 2023, 6:15 pm | #60 |
Octode
Join Date: Mar 2011
Location: North Yorkshire, UK.
Posts: 1,120
|
Re: Anyone building a PICL? more PCBs available
Just 'File' 'Send file' David
'Transfer' is for protocols like xmodem, kermit etc whereas 'File, Send file' just spools ascii text which is what we want Cheers Phil PS Also, you can copy & paste - highlight the NIBL code in notepad, ctrl/C, go into Teraterm, Alt/V PPS Also you can copy & paste from the Teraterm buffer, say you listed a program but then accidentally typed NEW (like you do) you could scroll back through the buffer, click&drag to highlight just the listing, Alt/C then Alt/V PPPS - ¡ ƃuıʎɐןd ʇsnɾ ɯ,I - ɥɐu.... Last edited by Phil__G; 3rd Apr 2023 at 6:26 pm. |